File tree Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Expand file tree Collapse file tree 1 file changed +11
-4
lines changed Original file line number Diff line number Diff line change @@ -53,21 +53,28 @@ function Tokens (options) {
53
53
return new Tokens ( options )
54
54
}
55
55
56
- var opts = Object . assign ( { } , DefaultOptions , options || { } )
56
+ var opts = options || { }
57
+
58
+ var saltLength = opts . saltLength !== undefined
59
+ ? opts . saltLength
60
+ : DefaultOptions . saltLength
57
61
58
- var saltLength = opts . saltLength
59
62
60
63
if ( typeof saltLength !== 'number' || ! isFinite ( saltLength ) || saltLength < 1 ) {
61
64
throw new TypeError ( 'option saltLength must be finite number > 1' )
62
65
}
63
66
64
- var secretLength = opts . secretLength
67
+ var secretLength = opts . secretLength !== undefined
68
+ ? opts . secretLength
69
+ : DefaultOptions . secretLength
65
70
66
71
if ( typeof secretLength !== 'number' || ! isFinite ( secretLength ) || secretLength < 1 ) {
67
72
throw new TypeError ( 'option secretLength must be finite number > 1' )
68
73
}
69
74
70
- var hashAlgorithm = opts . hashAlgorithm
75
+ var hashAlgorithm = opts . hashAlgorithm !== undefined
76
+ ? opts . hashAlgorithm
77
+ : DefaultOptions . hashAlgorithm
71
78
72
79
if ( typeof hashAlgorithm !== 'string' || ! hashAlgorithm ) {
73
80
throw new TypeError ( 'option hashAlgorithm must be valid hash algorithn' )
You can’t perform that action at this time.
0 commit comments