Socket
Socket
Sign inDemoInstall

object.getownpropertydescriptors

Package Overview
Dependencies
67
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    object.getownpropertydescriptors

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


Version published
Weekly downloads
11M
increased by2.32%
Maintainers
1
Install size
3.63 MB
Created
Weekly downloads
 

Changelog

Source

v2.1.6 - 2023-04-20

Commits

  • [Refactor] use safe-array-concat a717eb2
  • [Dev Deps] update @es-shims/api, @ljharb/eslint-config, aud, tape b08d70f
  • [Deps] update define-properties, es-abstract 95c8479
<!-- auto-changelog-above -->

2.1.4 / 2022-05-19

  • [Fix] Array.prototype.reduce isn’t present in ES3 engines
  • [meta] use npmignore to autogenerate an npmignore file
  • [Deps] update define-properties, es-abstract
  • [Dev Deps] update eslint, @ljharb/eslint-config, @es-shims/api, aud, auto-changelog, functions-have-names, safe-publish-latest, tape
  • [Tests] use mock-property
  • [actions] reuse common workflows
  • [actions] update codecov uploader

2.1.3 / 2021-10-03

  • [readme] remove travis badge; add actions and codecov badges
  • [Deps] update es-abstract
  • [meta] use prepublishOnly script for npm 7+
  • [Dev Deps] update eslint, @ljharb/eslint-config, @es-shims/api, aud, tape
  • [actions] update workflows
  • [actions] use node/install instead of node/run; use codecov action

2.1.2 / 2021-02-20

  • [Deps] update call-bind, es-abstract
  • [Dev Deps] update eslint, @ljharb/eslint-config, aud, functions-have-names, has-strict-mode, tape
  • [meta] do not publish github action workflow files
  • [meta] gitignore coverage output
  • [actions] update workflows

2.1.1 / 2020-11-26

  • [Fix] do not mutate the native function when present
  • [Deps] update es-abstract; use call-bind where applicable
  • [meta] remove unused Makefile and associated utilities
  • [Dev Deps] update eslint, @ljharb/eslint-config, tape, functions-have-names; add aud
  • [actions] add Require Allow Edits workflow
  • [actions] switch Automatic Rebase workflow to pull_request_target event
  • [Tests] migrate tests to Github Actions
  • [Tests] run nyc on all tests
  • [Tests] add implementation test; run es-shim-api in postlint; use tape runner
  • [Tests] only audit prod deps

2.1.0 / 2019-12-12

  • [New] add auto entry point
  • [Refactor] use split-up es-abstract (78% bundle size decrease)
  • [readme] fix repo URLs, remove testling
  • [Docs] Fix formatting in the README (#30)
  • [Deps] update define-properties, es-abstract
  • [Dev Deps] update eslint, @ljharb/eslint-config, functions-have-names, covert, replace, semver, tape, @es-shims/api; add safe-publish-latest
  • [meta] add funding field
  • [meta] Only apps should have lockfiles.
  • [Tests] use shared travis-ci configs
  • [Tests] use functions-have-names
  • [Tests] use npx aud instead of nsp or npm audit with hoops
  • [Tests] remove jscs
  • [actions] add automatic rebasing / merge commit blocking

2.0.3 / 2016-07-26

  • [Fix] Update implementation to not return undefined descriptors
  • [Deps] update es-abstract
  • [Dev Deps] update eslint, @ljharb/eslint-config, @es-shims/api, jscs, nsp, tape, semver
  • [Dev Deps] remove unused eccheck script + dep
  • [Tests] up to node v6.3, v5.12, v4.4
  • [Tests] use pretest/posttest for linting/security
  • Update to stage 4

2.0.2 / 2016-01-27

  • [Fix] ensure that Object.getOwnPropertyDescriptors does not fail when Object.prototype has a poisoned setter (#1, #2)

2.0.1 / 2016-01-27

  • [Deps] move @es-shims/api to dev deps

2.0.0 / 2016-01-27

  • [Breaking] implement the es-shims API
  • [Deps] update define-properties, es-abstract
  • [Dev Deps] update tape, jscs, nsp, eslint, @ljharb/eslint-config, semver
  • [Tests] fix npm upgrades in older nodes
  • [Tests] up to node v5.5
  • [Docs] Switch from vb.teelaun.ch to versionbadg.es for the npm version badge SVG

1.0.4 / 2015-07-20

  • [Tests] Test on io.js v2.4
  • [Deps, Dev Deps] Update define-properties, tape, eslint, semver

1.0.3 / 2015-06-28

  • Increase robustness by caching Array#{concat, reduce}
  • [Deps] Update define_properties
  • [Dev Deps] Update eslint, semver, nsp
  • [Tests] Test up to io.js v2.3

1.0.2 / 2015-05-23

  • Update es-abstract, tape, eslint, jscs, semver, covert
  • Test up to io.js v2.0

1.0.1 / 2015-03-20

  • Update es-abstract, editorconfig-tools, nsp, eslint, semver, replace

1.0.0 / 2015-02-17

  • v1.0.0

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

Last updated on 07 Nov 2022

Did you know?

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc