Skip to content

Major version

Compare
Choose a tag to compare
@dhoulb dhoulb released this 11 Sep 04:07

This is a major version introducing several breaking changes and removes several features in order to significantly reduce bloat and bundle size. Please review changes carefully before upgrading.

  • Changes to simplify check()
    • Removed prefix as third argument (check() now accepts only value, type, error)
    • Added prefix: X string modifier type instead to cover the same functionality
    • e.g. check(123, "name: string") will throw "name: Must be string (received 123)")
  • Types can only be specified as strings now:
    • Removed ability to use a literal array or object as the type in check() (use array and object string types instead)
    • Removed ability to use a literal function as an instanceof in check() (add a custom named checker with add() and use that instead)
    • Removed ability to use constructors (e.g. Number) as a type in check() (use "num" etc instead)
  • Remove excess barely-used and bloated functionality:
    • Removed blork() function that created an independent instance of Blork (unnecessary bloat)
    • Removed throws() function (confusing bloat — use third argument of check() instead)
    • Removed args() function (created inconsistencies — use several check() calls instead)
    • Removed assert() function (was confusing to use — use if (!X) throw Error instead as it's more explicit)
  • Add Flow type declaration for exported functions