Skip to content

Commit

Permalink
🌫
Browse files Browse the repository at this point in the history
  • Loading branch information
transitive-bullshit committed Nov 8, 2022
1 parent bc50b19 commit 4243d10
Showing 1 changed file with 3 additions and 2 deletions.
5 changes: 3 additions & 2 deletions src/rng-factory.ts
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ import RNGFunction from './generators/function'
* new Random(RNGFactory(...args))
*/
export default <T extends any[]>(...args: T) => {
const [arg0 = 'default', ...rest] = args
const [arg0 = 'default'] = args

switch (typeof arg0) {
case 'object':
Expand All @@ -26,7 +26,8 @@ export default <T extends any[]>(...args: T) => {

case 'number':
case 'string':
return new RNGFunction(seedrandom(...rest))
default:
return new RNGFunction(seedrandom(...args))
}

throw new Error(`invalid RNG "${arg0}"`)
Expand Down

0 comments on commit 4243d10

Please sign in to comment.