Closed willrstern closed 9 years ago
Always possible that I'm missing something... But I can't get custom data types working: http://codepen.io/anon/pen/VYNNQE?editors=001
var schemator = new Schemator(); schemator.defineDataType('NaN', function (x) { if (isNaN(x)) { return null; } else { return { rule: 'type', actual: typeof x, expected: 'NaN' }; } }); var schema = schemator.defineSchema('mySchema', { notNumber: { type: 'NaN' } }); var errors = schema.validateSync({ notNumber: 123 }); console.log('never errors for any value?', errors);
Fixed in 1.2.1
Thanks!
Always possible that I'm missing something... But I can't get custom data types working: http://codepen.io/anon/pen/VYNNQE?editors=001