object/has-own-property
v0.0.1
0.0.1
Collaborators
Gravatar for undefined
0
MIT
PUBLIC
6
0     DEPENDENCIES
BuildPass

Determines whether the object has the specified property.

Use object/has-own-property in your project
npm i @bit/bit.utils.object.has-own-property

hasOwnProperty (obj:object, prop:(string|number)) : boolean

Determines whether the object has the specified property.

Example

hasOwnProperty({foo: 'bar'}, 'foo') // => true
 hasOwnProperty({foo: 'bar'}, 'bar') // => false

Arguments

obj: object

prop: (string|number)

property to test

Returns

boolean

Test Summary


#hasOwnProperty() should return false as given object do not contain key `bar`Pass
#hasOwnProperty() should return true as given object contains key `foo`Pass
#hasOwnProperty() should return false if key is nullPass