![]() | Name | Last modified | Size | Description |
---|---|---|---|---|
![]() | Parent Directory | - | ||
![]() | test/ | 2 years ago | - | |
![]() | node_modules/ | 2 years ago | - | |
![]() | shim.js | 2 years ago | 381 | 0fb859dc fixed mobile overflwo options [كارل مبارك] |
![]() | polyfill.js | 2 years ago | 227 | 0fb859dc fixed mobile overflwo options [كارل مبارك] |
![]() | package.json | 2 years ago | 3.5K | 0fb859dc fixed mobile overflwo options [كارل مبارك] |
![]() | index.js | 2 years ago | 316 | 0fb859dc fixed mobile overflwo options [كارل مبارك] |
![]() | implementation.js | 2 years ago | 1.2K | 0fb859dc fixed mobile overflwo options [كارل مبارك] |
![]() | auto.js | 2 years ago | 36 | 0fb859dc fixed mobile overflwo options [كارل مبارك] |
![]() | README.md | 2 years ago | 3.4K | 0fb859dc fixed mobile overflwo options [كارل مبارك] |
![]() | Makefile | 2 years ago | 3.7K | 0fb859dc fixed mobile overflwo options [كارل مبارك] |
![]() | LICENSE | 2 years ago | 1.1K | 0fb859dc fixed mobile overflwo options [كارل مبارك] |
![]() | CHANGELOG.md | 2 years ago | 2.4K | 0fb859dc fixed mobile overflwo options [كارل مبارك] |
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.
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));
Simply clone the repo, npm install
, and run npm test