Skip to content

Commit

Permalink
[Deps] update call-bind, es-abstract, es-get-iterator, `get-int…
Browse files Browse the repository at this point in the history
…rinsic`, `globalthis`, `has-symbols`, `internal-slot`, `object.entries`
  • Loading branch information
ljharb committed Oct 5, 2021
1 parent 55fad2f commit 165d4e3
Show file tree
Hide file tree
Showing 9 changed files with 48 additions and 50 deletions.
4 changes: 4 additions & 0 deletions .eslintrc
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,13 @@
"max-statements": 0,
"new-cap": [2, {
"capIsNewExceptions": [
"AddEntriesFromIterable",
"ArrayFrom",
"Call",
"CreateIterResultObject",
"CreateMethodProperty",
"DefinePropertyOrThrow",
"Get",
"GetIntrinsic",
"GetIterator",
"HasOwnProperty",
Expand Down
4 changes: 2 additions & 2 deletions implementation.js
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,8 @@ var define = require('define-properties');
var callBound = require('call-bind/callBound');
var GetIntrinsic = require('get-intrinsic');
var SLOT = require('internal-slot');
var SameValue = require('es-abstract/2020/SameValue');
var SameValueZero = require('es-abstract/2020/SameValueZero');
var SameValue = require('es-abstract/2021/SameValue');
var SameValueZero = require('es-abstract/2021/SameValueZero');

var MapEntry = require('./lib/map-entry');
var MapIterator = require('./lib/map-iterator');
Expand Down
22 changes: 6 additions & 16 deletions lib/helpers.js
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
'use strict';

var define = require('define-properties');
var hasSymbols = require('has-symbols')();
var GetIntrinsic = require('get-intrinsic');
var SLOT = require('internal-slot');
var entries = require('object.entries');
var forEach = require('foreach');
var OrdinaryObjectCreate = require('es-abstract/2020/OrdinaryObjectCreate');
var Type = require('es-abstract/2020/Type');
var CreateMethodProperty = require('es-abstract/2021/CreateMethodProperty');
var OrdinaryObjectCreate = require('es-abstract/2021/OrdinaryObjectCreate');
var Type = require('es-abstract/2021/Type');

var $ObjectCreate = GetIntrinsic('%Object.create%', true);

Expand Down Expand Up @@ -79,19 +79,9 @@ exports.addIterator = function (prototype, impl) {
// eslint-disable-next-line no-invalid-this
return this;
};
if (define.supportsDescriptors) {
Object.defineProperty(prototype, $iterator$, {
configurable: true,
enumerable: false,
value: implementation,
writable: true
});
if (!prototype[$iterator$] && Type($iterator$) === 'Symbol') {
// implementations are buggy when $iterator$ is a Symbol
// eslint-disable-next-line no-param-reassign
prototype[$iterator$] = implementation;
}
} else {
CreateMethodProperty(prototype, $iterator$, implementation);
if (!prototype[$iterator$] && Type($iterator$) === 'Symbol') {
// implementations are buggy when $iterator$ is a Symbol
// eslint-disable-next-line no-param-reassign
prototype[$iterator$] = implementation;
}
Expand Down
14 changes: 7 additions & 7 deletions lib/map-helpers.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
'use strict';

var ToString = require('es-abstract/2020/ToString');
var Type = require('es-abstract/2020/Type');
var IsArray = require('es-abstract/2020/IsArray');
var IsCallable = require('es-abstract/2020/IsCallable');
var IteratorStep = require('es-abstract/2020/IteratorStep');
var IteratorClose = require('es-abstract/2020/IteratorClose');
var Call = require('es-abstract/2020/Call');
var Call = require('es-abstract/2021/Call');
var IsArray = require('es-abstract/2021/IsArray');
var IsCallable = require('es-abstract/2021/IsCallable');
var IteratorClose = require('es-abstract/2021/IteratorClose');
var IteratorStep = require('es-abstract/2021/IteratorStep');
var ToString = require('es-abstract/2021/ToString');
var Type = require('es-abstract/2021/Type');
var GetIterator = require('es-get-iterator');

var MapIterator = require('./map-iterator');
Expand Down
26 changes: 15 additions & 11 deletions lib/map-iterator.js
Original file line number Diff line number Diff line change
@@ -1,12 +1,13 @@
'use strict';

var define = require('define-properties');
var hasSymbols = require('has-symbols')();
var SLOT = require('internal-slot');

var GetIntrinsic = require('get-intrinsic');
var CreateIterResultObject = require('es-abstract/2020/CreateIterResultObject');
var OrdinaryObjectCreate = require('es-abstract/2020/OrdinaryObjectCreate');
var CreateIterResultObject = require('es-abstract/2021/CreateIterResultObject');
var CreateMethodProperty = require('es-abstract/2021/CreateMethodProperty');
var DefinePropertyOrThrow = require('es-abstract/2021/DefinePropertyOrThrow');
var OrdinaryObjectCreate = require('es-abstract/2021/OrdinaryObjectCreate');

var requireMapSlot = require('./validation').requireMapSlot;
var addIterator = require('./helpers').addIterator;
Expand All @@ -28,8 +29,11 @@ if (IteratorPrototype) {
}
addIterator(MapIterator.prototype);

define(MapIterator.prototype, {
next: function next() {
CreateMethodProperty(
MapIterator.prototype,
'next',
function next() {
/* eslint no-invalid-this: 0 */
if (!SLOT.has(this, '[[isMapIterator]]')) {
throw new TypeError('Not a MapIterator');
}
Expand Down Expand Up @@ -63,14 +67,14 @@ define(MapIterator.prototype, {
SLOT.set(this, '[[i]]', void undefined);
return CreateIterResultObject(void undefined, true);
}
});
);

if (hasSymbols && Symbol.toStringTag) {
Object.defineProperty(MapIterator.prototype, Symbol.toStringTag, {
configurable: true,
enumerable: false,
value: 'Map Iterator',
writable: false
DefinePropertyOrThrow(MapIterator.prototype, Symbol.toStringTag, {
'[[Configurable]]': true,
'[[Enumerable]]': false,
'[[Value]]': 'Map Iterator',
'[[Writable]]': false
});
}

Expand Down
4 changes: 2 additions & 2 deletions lib/validation.js
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
'use strict';

var SLOT = require('internal-slot');
var ToString = require('es-abstract/2020/ToString');
var Type = require('es-abstract/2020/Type');
var ToString = require('es-abstract/2021/ToString');
var Type = require('es-abstract/2021/Type');

var isMap = function isMap(map) {
return SLOT.has(map, '[[es6map]]');
Expand Down
16 changes: 8 additions & 8 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -66,16 +66,16 @@
"tape": "^5.3.1"
},
"dependencies": {
"call-bind": "^1.0.0",
"call-bind": "^1.0.2",
"define-properties": "^1.1.3",
"es-abstract": "^1.18.0-next.1",
"es-get-iterator": "^1.1.1",
"es-abstract": "^1.19.1",
"es-get-iterator": "^1.1.2",
"for-each": "^0.3.3",
"get-intrinsic": "^1.0.2",
"globalthis": "^1.0.1",
"has-symbols": "^1.0.1",
"internal-slot": "^1.0.2",
"object.entries": "^1.1.3"
"get-intrinsic": "^1.1.1",
"globalthis": "^1.0.2",
"has-symbols": "^1.0.2",
"internal-slot": "^1.0.3",
"object.entries": "^1.1.5"
},
"auto-changelog": {
"output": "CHANGELOG.md",
Expand Down
4 changes: 2 additions & 2 deletions shim.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,8 +7,8 @@ var getPolyfill = require('./polyfill');
var support = require('./lib/support');
var addIterableToMap = require('./lib/map-helpers').addIterableToMap;

var OrdinarySetPrototypeOf = require('es-abstract/2020/OrdinarySetPrototypeOf');
var Call = require('es-abstract/2020/Call');
var OrdinarySetPrototypeOf = require('es-abstract/2021/OrdinarySetPrototypeOf');
var Call = require('es-abstract/2021/Call');

var force = function () {
return true;
Expand Down
4 changes: 2 additions & 2 deletions test/tests.js
Original file line number Diff line number Diff line change
@@ -1,11 +1,11 @@
'use strict';

var HasOwnProperty = require('es-abstract/2020/HasOwnProperty');
var HasOwnProperty = require('es-abstract/2021/HasOwnProperty');
var isEnumerable = Object.prototype.propertyIsEnumerable;
var functionsHaveNames = require('functions-have-names')();
var define = require('define-properties');
var hasSymbols = require('has-symbols')();
var ArrayFrom = require('array.from').implementation;
var ArrayFrom = require('array.from/implementation');

// eslint-disable-next-line max-params
var testMapping = function testMapping(t, map, key, value, desc) {
Expand Down

0 comments on commit 165d4e3

Please sign in to comment.