@aicacia/changeset
TypeScript icon, indicating that this package has built-in type declarations

0.1.10 • Public • Published

ts-changeset

license docs npm (scoped) build

ecto like changesets for typescript

const changesetFn = (changeset: Changeset) =>
  changeset
    .validateAcceptance("agreedToTerms")
    .validateLength("age", { gt: 18 })
    .validateFormat("name", /[A-Za-z0-9\-_]+/)
    .validateRequired(["age", "name", "agreedToTerms"]);

let changeset = new Changeset({
  age: 0,
  name: "",
  agreedToTerms: false,
});

let changeset = changesetFn(changeset);

console.log(changeset.getErrors());
console.log(changeset.isValid());

/@aicacia/changeset/

    Package Sidebar

    Install

    npm i @aicacia/changeset

    Weekly Downloads

    2

    Version

    0.1.10

    License

    (MIT OR Apache-2.0)

    Unpacked Size

    46.6 kB

    Total Files

    15

    Last publish

    Collaborators

    • nathanfaucett