Skip to content

Commit 93153b8

Browse files
committed
use idiomatic JS
1 parent 95e5d7b commit 93153b8

File tree

1 file changed

+5
-1
lines changed

1 file changed

+5
-1
lines changed

src/combineReducers.ts

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -40,9 +40,13 @@ function getUnexpectedStateShapeWarningMessage(
4040
}
4141

4242
if (!isPlainObject(inputState)) {
43+
const match = Object.prototype.toString
44+
.call(inputState)
45+
.match(/\s([a-z|A-Z]+)/)
46+
const matchType = match ? match[1] : ''
4347
return (
4448
`The ${argumentName} has unexpected type of "` +
45-
({} as any).toString.call(inputState).match(/\s([a-z|A-Z]+)/)[1] +
49+
matchType +
4650
`". Expected argument to be an object with the following ` +
4751
`keys: "${reducerKeys.join('", "')}"`
4852
)

0 commit comments

Comments
 (0)