npm stats
  • Search
  • About
  • Repo
  • Sponsor
  • more
    • Search
    • About
    • Repo
    • Sponsor

Made by Antonio Ramirez

get-own-property-descriptors-polyfill

1.0.1

@watson

npmHomeRepoSnykSocket
Downloads:13
$ npm install get-own-property-descriptors-polyfill
DailyWeeklyMonthlyYearly

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