Major version
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)")
- Removed
- 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
incheck()
(add a custom named checker withadd()
and use that instead) - Removed ability to use constructors (e.g.
Number
) as a type incheck()
(use"num"
etc instead)
- Removed ability to use a literal array or object as the type in
- 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 ofcheck()
instead) - Removed
args()
function (created inconsistencies — use severalcheck()
calls instead) - Removed
assert()
function (was confusing to use — useif (!X) throw Error
instead as it's more explicit)
- Removed
- Add Flow type declaration for exported functions