are-set
v1.0.5
Published
a function that returns if a key is in a object
Downloads
18
Maintainers
Readme
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