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

1.0.5 • Public • Published

are-set

usage

import areSet, { areSetAndTheSameType, match } from "are-set";

const dataYouDontKnow = JSON.parse('{"hello": true}');

// use this:
cosnole.log(
  "are in the object and the same type (with object as key value pair)",
  // [[key, type]]
  match(dataYouDontKnow, { hello: "boolean" })
);

// dont need typecheck
console.log(
  "keys are in object",
  // keys in string array
  areSet(dataYouDontKnow, ["hello"])
);

// other style
cosnole.log(
  "are in the object and the same type",
  // [[key, type]]
  areSetAndTheSameType(dataYouDontKnow, [["hello", "boolean"]])
);

install

npm i are-set

Package Sidebar

Install

npm i are-set

Weekly Downloads

4

Version

1.0.5

License

ISC

Unpacked Size

3.44 kB

Total Files

5

Last publish

Collaborators

  • manuelwestermeier