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