Skip to content

Commit

Permalink
Add nano-md5_v1.x.x (#1844)
Browse files Browse the repository at this point in the history
* Add nano-md5_v1.x.x

* Remove toHex function

* Fix default imports and add changed String class

* Add test for default import
  • Loading branch information
fabulator authored and AndrewSouthpaw committed Feb 15, 2018
1 parent 8d18f67 commit 304d88c
Show file tree
Hide file tree
Showing 2 changed files with 22 additions and 0 deletions.
12 changes: 12 additions & 0 deletions definitions/npm/nano-md5_v1.x.x/flow_v0.65.x-/nano-md5_v1.x.x.js
@@ -0,0 +1,12 @@
class ExtendedString extends String {
toHex: () => string;
}

declare module "nano-md5" {
declare module.exports: {
(utf8_string: string): string;
fromBytes (bytes_string: string): ExtendedString;
fromUtf8 (utf8_string: string): ExtendedString;
crypt (password: string, settings: string): string;
}
}
10 changes: 10 additions & 0 deletions definitions/npm/nano-md5_v1.x.x/test_nano-md5_v1.x.x.js
@@ -0,0 +1,10 @@
import md5 from "nano-md5";

// $ExpectError: accept only strings
md5(6);

const encoded: string = md5('some-string');

md5.fromUtf8('hello').toHex();
md5.fromBytes('hello').toHex();
md5.crypt('hello', '$1$01234567');

0 comments on commit 304d88c

Please sign in to comment.