Skip to content

Commit

Permalink
fix: only non-iterable, non-Date objects, regardless of prototype are…
Browse files Browse the repository at this point in the history
… valid for Object type (#383)
  • Loading branch information
vtsio87 committed Jul 16, 2020
1 parent 151d8cc commit ab227a3
Showing 1 changed file with 1 addition and 1 deletion.
2 changes: 1 addition & 1 deletion package/lib/validation/typeValidator/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,7 @@ export default function typeValidator() {

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

Expand Down

0 comments on commit ab227a3

Please sign in to comment.