Skip to content

Commit ab227a3

Browse files
authored
fix: only non-iterable, non-Date objects, regardless of prototype are valid for Object type (#383)
1 parent 151d8cc commit ab227a3

File tree

1 file changed

+1
-1
lines changed
  • package/lib/validation/typeValidator

1 file changed

+1
-1
lines changed

package/lib/validation/typeValidator/index.js

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ export default function typeValidator() {
2424

2525
if (expectedType === Object || SimpleSchema.isSimpleSchema(expectedType)) {
2626
// Is it an object?
27-
if (Object.prototype.toString.call(keyValue) === '[object Object]') return;
27+
if (keyValue === Object(keyValue) && typeof keyValue[Symbol.iterator] !== 'function' && !(keyValue instanceof Date)) return;
2828
return { type: SimpleSchema.ErrorTypes.EXPECTED_TYPE, dataType: 'Object' };
2929
}
3030

0 commit comments

Comments
 (0)