yavisht / has-key

A simple way to check if an object has the specified key. Great to prevent app errors!

Home Page:https://www.npmjs.com/package/@yavisht/has-key

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Release GitHub release (latest SemVer) semantic-release

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

About

A simple way to check if an object has the specified key. Great to prevent app errors!

https://www.npmjs.com/package/@yavisht/has-key

License:MIT License


Languages

Language:JavaScript 100.0%