🤖 Merge PR #58638 [md5] remove unnecessary reference to node types by @bug-brain

* [md5] remove reference to node types

* [md5] adjust JSDoc
This commit is contained in:
bug-brain
2022-02-08 12:30:04 +01:00
committed by GitHub
parent c46eb6974d
commit d7c0d7353b
2 changed files with 7 additions and 16 deletions

16
types/md5/index.d.ts vendored
View File

@@ -6,18 +6,16 @@
// Ruslan Arkhipau <https://github.com/DethAriel>
// Definitions: https://github.com/DefinitelyTyped/DefinitelyTyped
/// <reference types="node" />
/**
* js function for hashing messages with MD5
* Calculate the MD5 hash of a message.
*
* @param message - a string or buffer to hash
* @param options
* @returns the resultant MD5 hash of the given message
* @param message - Message to hash.
* @param options - Input and output options.
* @returns MD5 hash.
*/
declare function md5(message: string | Buffer | number[] | Uint8Array, options: md5.Options & { asBytes: true }): number[];
declare function md5(message: string | Buffer | number[] | Uint8Array, options?: Pick<md5.Options, 'asString' | 'encoding'>): string;
declare function md5(message: string | Buffer | number[] | Uint8Array, options?: md5.Options): string | number[];
declare function md5(message: string | number[] | Uint8Array, options: md5.Options & { asBytes: true }): number[];
declare function md5(message: string | number[] | Uint8Array, options?: Pick<md5.Options, 'asString' | 'encoding'>): string;
declare function md5(message: string | number[] | Uint8Array, options?: md5.Options): string | number[];
declare namespace md5 {
interface Options {

View File

@@ -5,13 +5,6 @@ const message = 'message';
// $ExpectType string
md5(message);
const array = new Array<number>(message.length);
for (let i = 0; i < message.length; ++i) array[i] = message.charCodeAt(i);
const buffer = Buffer.from(array);
// $ExpectType string
md5(buffer);
// $ExpectType string
md5('message', { asString: true });