Skip to content

Commit

Permalink
fixed performance in reducers
Browse files Browse the repository at this point in the history
  • Loading branch information
pavel-surinin committed Nov 11, 2018
1 parent cf301f5 commit ba3cb5e
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions src/array/reduce.ts
Original file line number Diff line number Diff line change
@@ -1,5 +1,4 @@
import eq from 'fast-deep-equal'
import { inCase } from '../if/InCase'
import { MethodMap } from '../map/MethodMap'
import { JMap } from '../map/JMap'
import { ImmutableBuilder } from '../map/ImmutableBuilder'
Expand All @@ -10,9 +9,9 @@ function use(...args: any[]) {
}

function valid(key: string) {
inCase(key)
.notTypeof('string')
.throw(`Resolved key must be a string, actual: value - ${key} type - ${typeof key}`)
if (typeof key === 'string') {
throw new Error(`Resolved key must be a string, actual: value - ${key} type - ${typeof key}`)
}
return key
}

Expand Down

0 comments on commit ba3cb5e

Please sign in to comment.