Skip to content

Commit 1b9968e

Browse files
author
George Thomas
committed
Use Array.isArray instead of instanceof
`instanceof` does not always return true for an array even if `array.isArray()` return true and `Object.prototype.toString()` returns `[Object Array]` http://blog.niftysnippets.org/2010/09/say-what.html#instanceof https://stackoverflow.com/questions/28779255/is-instanceof-array-better-than-isarray-in-javascript Fixes #124
1 parent 5ac00ea commit 1b9968e

File tree

1 file changed

+1
-1
lines changed

1 file changed

+1
-1
lines changed

src/condition.js

+1-1
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ export default class Condition {
1010
Object.assign(this, properties)
1111
if (booleanOperator) {
1212
let subConditions = properties[booleanOperator]
13-
if (!(subConditions instanceof Array)) {
13+
if (!(Array.isArray(subConditions))) {
1414
throw new Error(`"${booleanOperator}" must be an array`)
1515
}
1616
this.operator = booleanOperator

0 commit comments

Comments
 (0)