0.1.2 • Published 3 years ago

@crazywhite/js-check v0.1.2

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

js-check

npm npm bundle size
check some javascript data via vanillaJS

$ npm install @crazywhite/js-check
const { string_t, number_t, boolean_t, object_t, array_t, check } = require("@crazywhite/js-check");

check(string_t(), "this arg should be string"); // => true
check(string_t(), 12.3); // => false
check(string_t("abc"), "abc"); // => true

check(object_t(), { a: 1 }); // => true
check(object_t({ a: number_t() }), { a: 1 }); // => true
check(object_t({ a: number_t() }), { a: 1, b: 2 }); // => true

check(array_t(), ["abc"]); // => true
check(array_t([string_t(), number_t()]), ["abc", 123]); // => true

dev

npm install
npm run build

test

npm run test