Latest Socket ResearchMalicious Chrome Extension Performs Hidden Affiliate Hijacking.Details
Socket
Book a DemoInstallSign in
Socket

object.defineproperties

Package Overview
Dependencies
Maintainers
1
Versions
4
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

object.defineproperties

ES spec-compliant `Object.defineProperties` shim/polyfill/replacement that works as far down as ES3

Source
npmnpm
Version
1.0.2
Version published
Weekly downloads
1.3K
146.83%
Maintainers
1
Weekly downloads
 
Created
Source

object.defineproperties Version Badge

github actions coverage dependency status dev dependency status License Downloads

npm badge

An ES spec-compliant Object.defineProperties shim. Invoke its "shim" method to shim Object.defineProperties if it is unavailable or noncompliant.

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

Most common usage:

var assert = require('assert');
var defineProperties = require('object.defineproperties');

var descriptors = {
	a: {
		value: 2
	},
	c: {
		configurable: true,
		enumerable: true,
		value: 3,
		writable: true
	}
};

var obj = { a: 1, b: 2 };
var result = defineProperties(obj, descriptors);

assert.equal(obj, result); // same object
assert.deepEqual(obj, { a: 2, b: 2, c: 3 });

defineProperties.shim();

assert.deepEqual(
	Object.defineProperties({ a: 1, b: 2 }, descriptors),
	defineProperties({ a: 1, b: 2 }, descriptors)
);

Tests

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

Keywords

javascript

FAQs

Package last updated on 29 Aug 2023

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