Releases: theScottyJam/moat-maker
v2.2.0
v2.1.1
Contains a README update - it now provides a link to a new moat-maker-commonjs repo.
v2.1.0
- Added the
isValidator()
,isExpectation()
, andisLazyEvaluator()
methods, which allow you to check what type of value you have. - Fixed a bug that prevented negative bigint literals from being parsed.
v2.0.0
Remove support for the "Infinity" primitive literal.
Moat Maker is supposed to mirror TypeScript syntax as closely as possible. Unfortunately, it was a little too relax in how it interpreted primitive literals and would allow Infinity
and -Infinity
to be provided as types even though TypeScript itself does not support using Infinity
as a type. You can still make a validator expect Infinity
or -Infinity
to be present, you just have to interpolate those values into your validator as opposed to expecting type syntax to exist for it (the same has already been true for NaN
).
// WRONG: support has been removed for this.
const myValidator = validator`{ value: Infinity }`;
// CORRECT: You can still interpolate Infinity in to match against it.
const myValidator = validator`{ value: ${Infinity} }`;
As this project is still extremely young and has only recently been released, the hope is that no one has written code yet that relies on this somewhat niche behavior. Breaking changes like this may not be possible in the future.
v1.0.1
Fix major error preventing the library from being imported.
The library wasn't using the es module system quite right, which prevented anyone from actually importing and using this library. This issue was caught before the library got publicized anywhere.
v1.0.0
The initial release!
- Syntax that is available to be used in this release: Simple rules (number/string/object/etc), primitive literals, any/unknown, property rules (the object-like syntax), arrays, tuples, unions, intersection, and iterable matching syntax. Parentheses and comments also work as expected.
- Supported values that can be interpolated into a validator: primitives, classes (and functions), regular expressions, and special objects provided by this library.
- Available properties on the validator instance: .matches(), .assertMatches(), .assertionTypeGuard(), .assertArgs(), and .ruleset
- Available static properties found on the validator template tag: .from(), .fromRuleset(), .lazy(), .expectTo()
- Other available exports: ValidatorSyntaxError