Skip to content

watson/get-own-property-descriptors-polyfill

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

4 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

get-own-property-descriptors-polyfill

A polyfill for Object.getOwnPropertyDescriptors which wasn't included in Node.js until v7.0.0.

npm build status js-standard-style

Installation

npm install get-own-property-descriptors-polyfill --save

Usage

const assert = require('assert')
const getOwnPropertyDescriptors = require('get-own-property-descriptors-polyfill')

function getter () { return 'hello' }

const obj = Object.defineProperties({}, {
  foo: { value: 42, enumerable: false },
  bar: { get: getter }
})

const descriptors = getOwnPropertyDescriptors(obj)

assert.deepStrictEqual(descriptors, {
  foo: { value: 42, writable: false, enumerable: false, configurable: false },
  bar: { get: getter, set: undefined, enumerable: false, configurable: false }
})

License

MIT

About

A polyfill for Object.getOwnPropertyDescriptiors

Resources

License

Stars

Watchers

Forks

Packages

No packages published