Socket
Book a DemoInstallSign in
Socket

get-descriptor

Package Overview
Dependencies
Maintainers
1
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

get-descriptor

prototype-aware Object.getOwnPropertyDescriptor

latest
Source
npmnpm
Version
1.0.1
Version published
Maintainers
1
Created
Source

get-descriptor

Taking the 'own' out of Object.getOwnPropertyDescriptor.

Build Status

Same as Object.getOwnPropertyDescriptor except it searches the prototype chain to find the descriptor.

Installation

npm install get-descriptor

Example

var getDescriptor = require('get-descriptor')

var proto = {}

Object.defineProperty(proto, 'value', {
  value: 'hello',
  configurable: false,
  enumerable: false,
  writable: false
})

var obj = Object.create(proto)

// finds 'value' descriptor on prototype chain :D
getDescriptor(obj, 'value'), descriptor) // => { configurable: false, enumerable: false, value: 'hello', writable: false }

// without getDescriptor
Object.getOwnPropertyDescriptor(obj, 'value') // => null

License

MIT

Keywords

inspect

FAQs

Package last updated on 09 Aug 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts