4.1.2 • Published 5 years ago

has-own-property-x v4.1.2

Weekly downloads
11,829
License
MIT
Repository
github
Last release
5 years ago

has-own-property-x

Used to determine whether an object has an own property with the specified property key.

module.exports(object, property)boolean

The hasOwnProperty method returns a boolean indicating whether the object has the specified property. Does not attempt to fix known issues in older browsers, but does ES6ify the method.

Kind: Exported function
Returns: boolean - true if the property is set on object, else false.
Throws:

  • TypeError If object is null or undefined.
ParamTypeDescription
objectObjectThe object to test.
propertystring | SymbolThe name or Symbol of the property to test.

Example

import hasOwnProperty from 'has-own-property-x';

const o = {
  foo: 'bar',
};

console.log(hasOwnProperty(o, 'bar')); // false
console.log(hasOwnProperty(o, 'foo')); // true
hasOwnProperty(undefined, 'foo'); // TypeError: Cannot convert undefined or null to object
4.1.2

5 years ago

4.1.1

5 years ago

4.1.0

5 years ago

4.0.17

5 years ago

4.0.16

5 years ago

4.0.15

5 years ago

4.0.14

5 years ago

4.0.13

5 years ago

4.0.12

5 years ago

4.0.11

5 years ago

4.0.10

5 years ago

4.0.9

5 years ago

4.0.8

5 years ago

4.0.7

5 years ago

4.0.6

5 years ago

4.0.5

5 years ago

4.0.4

5 years ago

4.0.3

5 years ago

4.0.2

5 years ago

4.0.1

5 years ago

4.0.0

5 years ago

3.2.0

7 years ago

3.1.1

7 years ago

3.0.0

7 years ago

2.0.0

7 years ago

1.3.0

7 years ago

1.2.0

7 years ago

1.1.1

7 years ago

1.1.0

7 years ago

1.0.12

8 years ago

1.0.11

8 years ago

1.0.10

8 years ago

1.0.9

8 years ago

1.0.8

8 years ago

1.0.7

8 years ago

1.0.6

8 years ago

1.0.5

8 years ago

1.0.4

8 years ago

1.0.3

8 years ago

1.0.2

8 years ago

1.0.1

8 years ago

1.0.0

8 years ago