1.0.0 • Published 9 years ago

assert-key v1.0.0

Weekly downloads
3
License
MIT
Repository
github
Last release
9 years ago

assert-key Build Status

Assert that an object has a specified key

Install

$ npm install --save assert-key

Usage

var assertKey = require('assert-key')

assertKey({foo: 1}, 'foo')
//=> noop

assertKey({foo: 1}, 'bar')
//=> Error: expected bar in object

API

assertKey(object, key) -> undefined

object

Required
Type: object

The source object.

key

Required
Type: string

The key to expect.

License

MIT © Ben Drucker