exists-in
v1.0.0
Published
Checks an object to see if the given property exists
Downloads
1
Readme
exists-in
Checks an object to see if the given property exists
Install
yarn add exists-in
Usage
const existsIn = require("exists-in");
existsIn("a.b.c", {
a: {
b: {
c: "hooray!",
},
},
});
// > 'hooray!'
existsIn(
"a.b.c.d",
{
a: {
b: {
c: "hooray!",
},
},
},
"oops!" // Pass a default fallback option to return if the value does not exist
);
// > 'oops!'