Commit 61852f0 1 parent d5627c1 commit 61852f0 Copy full SHA for 61852f0
File tree 4 files changed +28
-10
lines changed
4 files changed +28
-10
lines changed Original file line number Diff line number Diff line change 1
- /**
2
- [FNV-1a](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function) non-cryptographic hash function.
1
+ declare const fnv1a : {
2
+ /**
3
+ [FNV-1a](https://en.wikipedia.org/wiki/Fowler%E2%80%93Noll%E2%80%93Vo_hash_function) non-cryptographic hash function.
3
4
4
- @returns The hash as a positive integer.
5
- */
6
- export default function fnv1a ( string : string ) : number ;
5
+ @returns The hash as a positive integer.
6
+
7
+ @example
8
+ ```
9
+ import fnv1a = require('@sindresorhus/fnv1a');
10
+
11
+ fnv1a('🦄🌈');
12
+ //=> 582881315
13
+ ```
14
+ */
15
+ ( string : string ) : number ;
16
+
17
+ // TODO: remove this in the next major version, refactor the whole definition to:
18
+ // declare function fnv1a(string: string): number;
19
+ // export = fnv1a;
20
+ default : typeof fnv1a ;
21
+ } ;
22
+
23
+ export = fnv1a ;
Original file line number Diff line number Diff line change @@ -16,4 +16,5 @@ const fnv1a = string => {
16
16
} ;
17
17
18
18
module . exports = fnv1a ;
19
+ // TODO: remove this in the next major version, refactor the whole definition to:
19
20
module . exports . default = fnv1a ;
Original file line number Diff line number Diff line change 1
- import { expectType } from 'tsd-check ' ;
2
- import fnv1a from '.' ;
1
+ import { expectType } from 'tsd' ;
2
+ import fnv1a = require ( '.' ) ;
3
3
4
4
expectType < number > ( fnv1a ( '🦄🌈' ) ) ;
Original file line number Diff line number Diff line change 13
13
"node" : " >=6"
14
14
},
15
15
"scripts" : {
16
- "test" : " xo && ava && tsd-check "
16
+ "test" : " xo && ava && tsd"
17
17
},
18
18
"files" : [
19
19
" index.js" ,
36
36
" vo"
37
37
],
38
38
"devDependencies" : {
39
- "ava" : " ^1.3 .1" ,
40
- "tsd-check " : " ^0.5.0 " ,
39
+ "ava" : " ^1.4 .1" ,
40
+ "tsd" : " ^0.7.1 " ,
41
41
"xo" : " ^0.24.0"
42
42
}
43
43
}
You can’t perform that action at this time.
0 commit comments