allreq
v0.1.0
Published
Declarative conditional template literal string type
Maintainers
Readme
allreq
Declarative conditional template literal string type.
npm install allreqyarn add allreqExamples
import { allreq } from 'allreq';
let v = allreq`this could be undefined.
if ${undefined} is undefined.`;
v === undefined; // trueThis 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