1.0.0 • Published 5 years ago

exists-in v1.0.0

Weekly downloads
1
License
MIT
Repository
github
Last release
5 years ago

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!'