Skip to content

Releases: theScottyJam/moat-maker

v2.2.0

13 Dec 19:00
Compare
Choose a tag to compare

Makes expectTo() a generic function, so you can optionally provide a type that your callback is expected to receive.

v2.1.1

01 Nov 06:32
Compare
Choose a tag to compare

Contains a README update - it now provides a link to a new moat-maker-commonjs repo.

v2.1.0

01 Nov 02:42
Compare
Choose a tag to compare
  • Added the isValidator(), isExpectation(), and isLazyEvaluator() 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

03 Jun 04:12
Compare
Choose a tag to compare

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

27 May 02:14
Compare
Choose a tag to compare

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

26 May 13:44
Compare
Choose a tag to compare

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