https://github.com/lamansky/get-own-property
[Node.js] Retrieves a property only if hasOwnProperty() is true.
https://github.com/lamansky/get-own-property
hasownproperty javascript nodejs property
Last synced: 3 months ago
JSON representation
[Node.js] Retrieves a property only if hasOwnProperty() is true.
- Host: GitHub
- URL: https://github.com/lamansky/get-own-property
- Owner: lamansky
- License: mit
- Created: 2017-11-28T14:51:55.000Z (over 8 years ago)
- Default Branch: master
- Last Pushed: 2017-11-28T15:02:46.000Z (over 8 years ago)
- Last Synced: 2025-04-25T15:05:50.856Z (about 1 year ago)
- Topics: hasownproperty, javascript, nodejs, property
- Language: JavaScript
- Homepage:
- Size: 1000 Bytes
- Stars: 0
- Watchers: 1
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: readme.md
- License: license.txt
Awesome Lists containing this project
README
# getOwnProperty
Retrieves a property only if [`hasOwnProperty()`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/hasOwnProperty) is true.
## Installation
```bash
npm install get-own-property --save
```
## Usage
```javascript
const getOwnProperty = require('get-own-property')
const obj = {hello: 'world'}
getOwnProperty(obj, 'hello') // 'world'
typeof obj.toString // 'function'
getOwnProperty(obj, 'toString') // undefined
```