0.1.0 • Published 2 years ago

allreq v0.1.0

Weekly downloads
-
License
MIT
Repository
github
Last release
2 years ago

allreq

Declarative conditional template literal string type.

NPM Version NPM Downloads License [changelog]


npm install allreq
yarn add allreq

Examples

import { allreq } from 'allreq';

let v = allreq`this could be undefined.
               if ${undefined} is undefined.`;

v === undefined; // true

This is how to make a new allreq.

import { newAllReq } from 'allreq';

const allreq = newAllReq(
  (anyArg: number) => anyArg <= 5,
  (invalidArg) => `${invalidArg} is <= 5`
);

let v = allreq`${0}, ${1}, ${2}, ${999} these are all <= 5`;

v === '999 is <= 5'; // true

License

MIT