Big update!Introducing GitHub Bot Commands. Learn more
Socket
Log inBook a demo

object.getownpropertydescriptors

Package Overview
Dependencies
4
Maintainers
1
Versions
15
Issues
File Explorer

Advanced tools

object.getownpropertydescriptors

ES2017 spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5.

    2.1.5latest

Version published
Maintainers
1
Weekly downloads
14,027,886
decreased by-12.37%

Weekly downloads

Readme

Source

object.getownpropertydescriptors Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES2017 spec-compliant shim for Object.getOwnPropertyDescriptors that works in ES5. Invoke its "shim" method to shim Object.getOwnPropertyDescriptors if it is unavailable, and if Object.getOwnPropertyDescriptor is available.

This package implements the es-shim API interface. It works in an ES3-supported environment and complies with the spec.

Example

var getDescriptors = require('object.getownpropertydescriptors'); var assert = require('assert'); var obj = { normal: Infinity }; var enumDescriptor = { enumerable: false, writable: false, configurable: true, value: true }; var writableDescriptor = { enumerable: true, writable: true, configurable: true, value: 42 }; var symbol = Symbol(); var symDescriptor = { enumerable: true, writable: true, configurable: false, value: [symbol] }; Object.defineProperty(obj, 'enumerable', enumDescriptor); Object.defineProperty(obj, 'writable', writableDescriptor); Object.defineProperty(obj, 'symbol', symDescriptor); var descriptors = getDescriptors(obj); assert.deepEqual(descriptors, { normal: { enumerable: true, writable: true, configurable: true, value: Infinity }, enumerable: enumDescriptor, writable: writableDescriptor, symbol: symDescriptor }); var getDescriptors = require('object.getownpropertydescriptors'); var assert = require('assert'); /* when Object.getOwnPropertyDescriptors is not present */ delete Object.getOwnPropertyDescriptors; var shimmedDescriptors = getDescriptors.shim(); assert.equal(shimmedDescriptors, getDescriptors); assert.deepEqual(shimmedDescriptors(obj), getDescriptors(obj)); var getDescriptors = require('object.getownpropertydescriptors'); var assert = require('assert'); /* when Object.getOwnPropertyDescriptors is present */ var shimmedDescriptors = getDescriptors.shim(); assert.notEqual(shimmedDescriptors, getDescriptors); assert.deepEqual(shimmedDescriptors(obj), getDescriptors(obj));

Tests

Simply clone the repo, npm install, and run npm test

Keywords

FAQs

What is object.getownpropertydescriptors?

ES2017 spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5.

Is object.getownpropertydescriptors popular?

The npm package object.getownpropertydescriptors receives a total of 11,257,291 weekly downloads. As such, object.getownpropertydescriptors popularity was classified as popular.

Is object.getownpropertydescriptors well maintained?

We found that object.getownpropertydescriptors demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago.It has 1 open source maintainer collaborating on the project.

Last updated on 07 Nov 2022

Did you know?

Socket installs a Github app to automatically flag issues on every pull request and report the health of your dependencies. Find out what is inside your node modules and prevent malicious activity before you update the dependencies.

Install Socket
Socket

Product

Subscribe to our newsletter

Get open source security insights delivered straight into your inbox. Be the first to learn about new features and product updates.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc