Changelog: v4.0.3...v5.0.0
-
Migrated to ES6.
-
Added essentials plugin for
RecordShape
:
import * as d from 'doubter/core';
import enableRecordEssentials from 'doubter/plugin/record-essentials';
enableRecordEssentials(RecordShape);
d.record(d.number()).allKeys('foo', 'bar');
- Issue messages can now be passed to parse methods of a shape:
d.string().parse(42, {
message: { 'type.string': 'Yo, not a string!' }
});
- Properties of options objects are now writable.
Breaking changes
-
The single issue code
type
was replaced with multiple codes:type.string
,type.number
, etc. -
Shape.messages
was removed. -
%s
placeholder isn't supported on messages anymore, use aMessageCallback
instead. -
Global error message formatter
ValidationError.formatIssues
andParseOptions.errorMessage
were removed. -
ApplyOptions
interface was merged intoParseOptions
.