Socket
Socket
Sign inDemoInstall

object.getownpropertydescriptors

Package Overview
Dependencies
65
Maintainers
1
Versions
18
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 2.0.2 to 2.0.3

test/.eslintrc

21

.jscs.json

@@ -48,3 +48,3 @@ {

"disallowQuotedKeysInObjects": "allButReserved",
"disallowQuotedKeysInObjects": { "allExcept": ["reserved"] },

@@ -158,4 +158,21 @@ "disallowSpaceAfterObjectKeys": true,

"allExcept": ["Function", "String", "Object", "Symbol", "Number", "Date", "RegExp", "Error", "Boolean", "Array"]
}
},
"requireImportAlphabetized": false,
"requireSpaceBeforeObjectValues": true,
"requireSpaceBeforeDestructuredValues": true,
"disallowSpacesInsideTemplateStringPlaceholders": true,
"disallowArrayDestructuringReturn": false,
"requireNewlineBeforeSingleStatementsInIf": false,
"disallowUnusedVariables": true,
"requireSpacesInsideImportedObjectBraces": true,
"requireUseStrict": true
}

@@ -0,1 +1,11 @@

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

@@ -2,0 +12,0 @@ =================

11

implementation.js

@@ -17,3 +17,3 @@ 'use strict';

var safePut = function put(obj, prop, val) {
var safePut = function put(obj, prop, val) { // eslint-disable-line max-params
if (defineProperty && prop in obj) {

@@ -33,9 +33,14 @@ defineProperty(obj, prop, {

ES.RequireObjectCoercible(value);
if (!isES5) { throw new TypeError('getOwnPropertyDescriptors requires Object.getOwnPropertyDescriptor'); }
if (!isES5) {
throw new TypeError('getOwnPropertyDescriptors requires Object.getOwnPropertyDescriptor');
}
var O = ES.ToObject(value);
return reduce(getAll(O), function (acc, key) {
safePut(acc, key, getDescriptor(O, key));
var descriptor = getDescriptor(O, key);
if (typeof descriptor !== 'undefined') {
safePut(acc, key, descriptor);
}
return acc;
}, {});
};
{
"name": "object.getownpropertydescriptors",
"version": "2.0.2",
"version": "2.0.3",
"author": "Jordan Harband",
"description": "ECMAScript spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5.",
"description": "ES2017 spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5.",
"license": "MIT",
"main": "index.js",
"scripts": {
"test": "npm run lint && es-shim-api && npm run tests-only && npm run security",
"tests-only": "npm run test:shimmed && npm run test:module",
"pretest": "npm run --silent lint && es-shim-api",
"test": "npm run --silent tests-only",
"posttest": "npm run --silent security",
"tests-only": "npm run --silent test:shimmed && npm run --silent test:module",
"test:shimmed": "node test/shimmed.js",

@@ -15,6 +17,5 @@ "test:module": "node test/index.js",

"coverage:quiet": "covert test/*.js --quiet",
"lint": "npm run jscs && npm run eslint",
"lint": "npm run --silent jscs && npm run --silent eslint",
"jscs": "jscs test/*.js *.js",
"eslint": "eslint test/*.js *.js",
"eccheck": "editorconfig-tools check *.js **/*.js > /dev/null",
"security": "nsp check"

@@ -30,3 +31,4 @@ },

"property descriptor",
"ES7",
"ES8",
"ES2017",
"shim",

@@ -39,15 +41,14 @@ "polyfill",

"define-properties": "^1.1.2",
"es-abstract": "^1.5.0"
"es-abstract": "^1.5.1"
},
"devDependencies": {
"tape": "^4.4.0",
"tape": "^4.6.0",
"covert": "^1.1.0",
"jscs": "^2.9.0",
"editorconfig-tools": "^0.1.1",
"nsp": "^2.2.0",
"eslint": "^1.10.3",
"@ljharb/eslint-config": "^1.6.1",
"semver": "^5.1.0",
"jscs": "^3.0.7",
"nsp": "^2.6.1",
"eslint": "^3.1.1",
"@ljharb/eslint-config": "^6.0.0",
"semver": "^5.3.0",
"replace": "^0.3.0",
"@es-shims/api": "^1.0.0"
"@es-shims/api": "^1.2.0"
},

@@ -54,0 +55,0 @@ "testling": {

@@ -13,6 +13,6 @@ #object.getownpropertydescriptors <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

An ECMAScript spec-compliant shim for `Object.getOwnPropertyDescriptors` that works in ES5.
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](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://github.com/tc39/proposal-object-getownpropertydescriptors).
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment and complies with the [spec](https://github.com/tc39/ecma262/pull/582).

@@ -19,0 +19,0 @@ ## Example

@@ -8,6 +8,8 @@ 'use strict';

var polyfill = getPolyfill();
define(Object, { getOwnPropertyDescriptors: polyfill }, {
getOwnPropertyDescriptors: function () { return Object.getOwnPropertyDescriptors !== polyfill; }
});
define(
Object,
{ getOwnPropertyDescriptors: polyfill },
{ getOwnPropertyDescriptors: function () { return Object.getOwnPropertyDescriptors !== polyfill; } }
);
return polyfill;
};

@@ -5,2 +5,3 @@ 'use strict';

var test = require('tape');
var runTests = require('./tests');

@@ -14,5 +15,5 @@ test('as a function', function (t) {

require('./tests')(getDescriptors, t);
runTests(getDescriptors, t);
t.end();
});

@@ -8,2 +8,3 @@ 'use strict';

var defineProperties = require('define-properties');
var runTests = require('./tests');
var isEnumerable = Object.prototype.propertyIsEnumerable;

@@ -32,5 +33,5 @@ var functionsHaveNames = function f() {}.name === 'f';

require('./tests')(Object.getOwnPropertyDescriptors, t);
runTests(Object.getOwnPropertyDescriptors, t);
t.end();
});

@@ -106,2 +106,23 @@ 'use strict';

});
/* global Proxy */
var supportsProxy = typeof Proxy === 'function';
t.test('Proxies that return an undefined descriptor', { skip: !supportsProxy }, function (st) {
var obj = { foo: true };
var fooDescriptor = Object.getOwnPropertyDescriptor(obj, 'foo');
var proxy = new Proxy(obj, {
getOwnPropertyDescriptor: function (target, key) {
return Object.getOwnPropertyDescriptor(target, key);
},
ownKeys: function () {
return [
'foo',
'bar'
];
}
});
st.deepEqual(getDescriptors(proxy), { foo: fooDescriptor }, 'object has no descriptors');
st.end();
});
};

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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