mirror of
https://github.com/chenasraf/DefinitelyTyped.git
synced 2026-05-18 01:49:01 +00:00
🤖 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:
16
types/md5/index.d.ts
vendored
16
types/md5/index.d.ts
vendored
@@ -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 {
|
||||
|
||||
@@ -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 });
|
||||
|
||||
|
||||
Reference in New Issue
Block a user