Checks for the existence of specified keys in an object
$ npm install keycheck
const keycheck = require("keycheck");
// ts: import * as keycheck from "keycheck";
const user = {
firstName: "willie",
lastName: "m.i.k."
};
const keys = ["firstName", "lastName", "age"]; // or "firstName lastName age"
const result = keycheck(user, keys);
// { firstName: true, lastName: true, age: false }
Param | Description |
---|---|
object | valid JSON object |
keys | delimited string or array of strings |
NOTE: Any character can be used as a delimiter except -
and _
.
Free software, Hell Yeah