allreq
TypeScript icon, indicating that this package has built-in type declarations

0.1.0 • Public • Published

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

Package Sidebar

Install

npm i allreq

Weekly Downloads

0

Version

0.1.0

License

MIT

Unpacked Size

8.56 kB

Total Files

17

Last publish

Collaborators

  • just.do.halee