Skip to content

v5.0.0

Latest
Compare
Choose a tag to compare
@github-actions github-actions released this 10 Jun 18:04
· 8 commits to next since this release

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 a MessageCallback instead.

  • Global error message formatter ValidationError.formatIssues and ParseOptions.errorMessage were removed.

  • ApplyOptions interface was merged into ParseOptions.