keys-in

Simple object key existence check Library

Usage no npm install needed!

<script type="module">
  import keysIn from 'https://cdn.skypack.dev/keys-in';
</script>

README

keys-in

codecov

Simple object key existence check Library

Installation

# use NPM
$ npm install -S keys-in

# use Yarn
$ yarn add keys-in

Usage

keysIn(payload: object, keys: string[]): boolean

import keysIn from 'keys-in'

const payload = { name: 'potato4d' }
const keys = ['name', 'email']

console.log(keysIn(payload, keys))
// false

payload.email = 'mail@potato4d.me'

console.log(keysIn(payload, keys))
// true

Contribution

# Install package
$ yarn

# Run test
$ yarn test

# Run test with coverage
$ yarn test:coverage

LICENSE

MIT