HasKey - Does the object have the key?
A simple util that will return true or false if the specified key is present in the object supplied.
What's New?
- Package now available on NPM and Github Package Registry
Installation
// NPM
npm i @yavisht/has-key
// Yarn
yarn add @yavisht/has-key
Usage
// require example
const hasKey = require('@yavisht/has-key')
// import example
import hasKey from '@yavisht/has-key'
// returns true
console.log(hasKey({foo:'bar'}, 'foo'))
// returns false
console.log(hasKey({foo:'bar'}, 'bar'))