dtypecheck
1.0.1 • Public • Published dtypecheck - dynamic typecheck helper
Note: It works with env NODE_ENV=development
Examples:
Simple
const t = require("dtypecheck");
const {expect} = require("chai");
const fn = t(
number => `${number}`,
number => expect(number).a(`number`),
string => expect(string).a(`string`)
);
fn(1)
fn([1, 2])
Async
const t = require("dtypecheck");
const {expect} = require("chai");
const fn = t(
async (number) => `${number}`,
async (number) => expect(number).a(`number`),
async (string) => expect(string).a(`string`)
);
(async () {
await fn(1)
await fn([1, 2])
})();
Package Sidebar
Install
Weekly Downloads