Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

core-js

Package Overview
Dependencies
Maintainers
1
Versions
276
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

core-js - npm Package Compare versions

Comparing version 3.23.3 to 3.23.4

internals/get-iterator-direct.js

8

internals/async-iterator-create-proxy.js
'use strict';
var call = require('../internals/function-call');
var aCallable = require('../internals/a-callable');
var anObject = require('../internals/an-object');

@@ -23,5 +22,8 @@ var create = require('../internals/object-create');

module.exports = function (nextHandler, IS_ITERATOR) {
var AsyncIteratorProxy = function AsyncIterator(state) {
var AsyncIteratorProxy = function AsyncIterator(record, state) {
if (state) {
state.iterator = record.iterator;
state.next = record.next;
} else state = record;
state.type = ASYNC_ITERATOR_PROXY;
state.next = aCallable(state.iterator.next);
state.done = false;

@@ -28,0 +30,0 @@ state.ignoreArgument = !IS_ITERATOR;

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

var getBuiltIn = require('../internals/get-built-in');
var getIteratorDirect = require('../internals/get-iterator-direct');
var getMethod = require('../internals/get-method');

@@ -17,6 +18,7 @@

var IS_SOME = TYPE == 3;
return function (iterator, fn, target) {
anObject(iterator);
return function (object, fn, target) {
var record = getIteratorDirect(object);
var Promise = getBuiltIn('Promise');
var next = aCallable(iterator.next);
var iterator = record.iterator;
var next = record.next;
var index = 0;

@@ -23,0 +25,0 @@ var MAPPING = fn !== undefined;

@@ -24,2 +24,3 @@ var bind = require('../internals/function-bind-context');

var AS_ENTRIES = !!(options && options.AS_ENTRIES);
var IS_RECORD = !!(options && options.IS_RECORD);
var IS_ITERATOR = !!(options && options.IS_ITERATOR);

@@ -42,3 +43,5 @@ var INTERRUPTED = !!(options && options.INTERRUPTED);

if (IS_ITERATOR) {
if (IS_RECORD) {
iterator = iterable.iterator;
} else if (IS_ITERATOR) {
iterator = iterable;

@@ -58,3 +61,3 @@ } else {

next = iterator.next;
next = IS_RECORD ? iterable.next : iterator.next;
while (!(step = call(next, iterator)).done) {

@@ -61,0 +64,0 @@ try {

'use strict';
var call = require('../internals/function-call');
var aCallable = require('../internals/a-callable');
var anObject = require('../internals/an-object');

@@ -20,5 +19,8 @@ var create = require('../internals/object-create');

module.exports = function (nextHandler, IS_ITERATOR) {
var IteratorProxy = function Iterator(state) {
var IteratorProxy = function Iterator(record, state) {
if (state) {
state.iterator = record.iterator;
state.next = record.next;
} else state = record;
state.type = ITERATOR_PROXY;
state.next = aCallable(state.iterator.next);
state.done = false;

@@ -25,0 +27,0 @@ state.ignoreArg = !IS_ITERATOR;

@@ -13,7 +13,13 @@ 'use strict';

var set = aCallable(map.set);
var value = (call(has, map, key) && 'update' in handler)
? handler.update(call(get, map, key), key, map)
: handler.insert(key, map);
call(set, map, key, value);
return value;
var value, inserted;
if (call(has, map, key)) {
value = call(get, map, key);
if ('update' in handler) {
value = handler.update(value, key, map);
call(set, map, key, value);
} return value;
}
inserted = handler.insert(key, map);
call(set, map, key, inserted);
return inserted;
};

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

// Fix browsers whose `exec` methods don't consistently return `undefined`
// for NPCG, like IE8. NOTE: This doesn' work for /(.?)?/
// for NPCG, like IE8. NOTE: This doesn't work for /(.?)?/
call(nativeReplace, match[0], reCopy, function () {

@@ -100,0 +100,0 @@ for (i = 1; i < arguments.length - 2; i++) {

@@ -7,7 +7,7 @@ var IS_PURE = require('../internals/is-pure');

})('versions', []).push({
version: '3.23.3',
version: '3.23.4',
mode: IS_PURE ? 'pure' : 'global',
copyright: '© 2014-2022 Denis Pushkarev (zloirock.ru)',
license: 'https://github.com/zloirock/core-js/blob/v3.23.3/LICENSE',
license: 'https://github.com/zloirock/core-js/blob/v3.23.4/LICENSE',
source: 'https://github.com/zloirock/core-js'
});

@@ -32,3 +32,3 @@ var DESCRIPTORS = require('../internals/descriptors');

var stringSlice = uncurryThis(''.slice);
// TODO: Use only propper RegExpIdentifierName
// TODO: Use only proper RegExpIdentifierName
var IS_NCG = /^\?<[^\s\d!#%&*+<=>@^][^\s!#%&*+<=>@^]*>/;

@@ -35,0 +35,0 @@ var re1 = /a/g;

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

// `%TypedArray%.prototype.reduceRicht` method
// `%TypedArray%.prototype.reduceRight` method
// https://tc39.es/ecma262/#sec-%typedarray%.prototype.reduceright

@@ -11,0 +11,0 @@ exportTypedArrayMethod('reduceRight', function reduceRight(callbackfn /* , initialValue */) {

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

var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy');

@@ -24,4 +25,3 @@

asIndexedPairs: function asIndexedPairs() {
return new AsyncIteratorProxy({
iterator: anObject(this),
return new AsyncIteratorProxy(getIteratorDirect(this), {
index: 0

@@ -28,0 +28,0 @@ });

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

var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var toPositiveInteger = require('../internals/to-positive-integer');

@@ -38,4 +39,3 @@ var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy');

drop: function drop(limit) {
return new AsyncIteratorProxy({
iterator: anObject(this),
return new AsyncIteratorProxy(getIteratorDirect(this), {
remaining: toPositiveInteger(limit)

@@ -42,0 +42,0 @@ });

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

var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy');

@@ -39,4 +40,3 @@

filter: function filter(filterer) {
return new AsyncIteratorProxy({
iterator: anObject(this),
return new AsyncIteratorProxy(getIteratorDirect(this), {
filterer: aCallable(filterer)

@@ -43,0 +43,0 @@ });

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

var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy');

@@ -59,4 +60,3 @@ var getAsyncIterator = require('../internals/get-async-iterator');

flatMap: function flatMap(mapper) {
return new AsyncIteratorProxy({
iterator: anObject(this),
return new AsyncIteratorProxy(getIteratorDirect(this), {
mapper: aCallable(mapper),

@@ -63,0 +63,0 @@ innerIterator: null,

@@ -11,2 +11,3 @@ // https://github.com/tc39/proposal-iterator-helpers

var getIterator = require('../internals/get-iterator');
var getIteratorDirect = require('../internals/get-iterator-direct');
var getIteratorMethod = require('../internals/get-iterator-method');

@@ -36,4 +37,4 @@ var getMethod = require('../internals/get-method');

}
return new AsyncIteratorProxy({ iterator: iterator !== undefined ? iterator : object });
return new AsyncIteratorProxy(getIteratorDirect(iterator !== undefined ? iterator : object));
}
});

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

var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy');

@@ -27,4 +28,3 @@

map: function map(mapper) {
return new AsyncIteratorProxy({
iterator: anObject(this),
return new AsyncIteratorProxy(getIteratorDirect(this), {
mapper: aCallable(mapper)

@@ -31,0 +31,0 @@ });

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

var getBuiltIn = require('../internals/get-built-in');
var getIteratorDirect = require('../internals/get-iterator-direct');

@@ -15,4 +16,5 @@ var Promise = getBuiltIn('Promise');

reduce: function reduce(reducer /* , initialValue */) {
var iterator = anObject(this);
var next = aCallable(iterator.next);
var record = getIteratorDirect(this);
var iterator = record.iterator;
var next = record.next;
var noInitial = arguments.length < 2;

@@ -19,0 +21,0 @@ var accumulator = noInitial ? undefined : arguments[1];

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

var call = require('../internals/function-call');
var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var toPositiveInteger = require('../internals/to-positive-integer');

@@ -29,4 +29,3 @@ var createAsyncIteratorProxy = require('../internals/async-iterator-create-proxy');

take: function take(limit) {
return new AsyncIteratorProxy({
iterator: anObject(this),
return new AsyncIteratorProxy(getIteratorDirect(this), {
remaining: toPositiveInteger(limit)

@@ -33,0 +32,0 @@ });

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

var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var createIteratorProxy = require('../internals/iterator-create-proxy');

@@ -17,4 +18,3 @@

asIndexedPairs: function asIndexedPairs() {
return new IteratorProxy({
iterator: anObject(this),
return new IteratorProxy(getIteratorDirect(this), {
index: 0

@@ -21,0 +21,0 @@ });

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

var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var toPositiveInteger = require('../internals/to-positive-integer');

@@ -28,4 +29,3 @@ var createIteratorProxy = require('../internals/iterator-create-proxy');

drop: function drop(limit) {
return new IteratorProxy({
iterator: anObject(this),
return new IteratorProxy(getIteratorDirect(this), {
remaining: toPositiveInteger(limit)

@@ -32,0 +32,0 @@ });

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

var aCallable = require('../internals/a-callable');
var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
every: function every(fn) {
anObject(this);
var record = getIteratorDirect(this);
aCallable(fn);
return !iterate(this, function (value, stop) {
return !iterate(record, function (value, stop) {
if (!fn(value)) return stop();
}, { IS_ITERATOR: true, INTERRUPTED: true }).stopped;
}, { IS_RECORD: true, INTERRUPTED: true }).stopped;
}
});

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

var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var createIteratorProxy = require('../internals/iterator-create-proxy');

@@ -27,4 +28,3 @@ var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');

filter: function filter(filterer) {
return new IteratorProxy({
iterator: anObject(this),
return new IteratorProxy(getIteratorDirect(this), {
filterer: aCallable(filterer)

@@ -31,0 +31,0 @@ });

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

var aCallable = require('../internals/a-callable');
var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
find: function find(fn) {
anObject(this);
var record = getIteratorDirect(this);
aCallable(fn);
return iterate(this, function (value, stop) {
return iterate(record, function (value, stop) {
if (fn(value)) return stop(value);
}, { IS_ITERATOR: true, INTERRUPTED: true }).result;
}, { IS_RECORD: true, INTERRUPTED: true }).result;
}
});

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

var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var getIteratorMethod = require('../internals/get-iterator-method');

@@ -48,4 +49,3 @@ var createIteratorProxy = require('../internals/iterator-create-proxy');

flatMap: function flatMap(mapper) {
return new IteratorProxy({
iterator: anObject(this),
return new IteratorProxy(getIteratorDirect(this), {
mapper: aCallable(mapper),

@@ -52,0 +52,0 @@ innerIterator: null,

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

var iterate = require('../internals/iterate');
var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
forEach: function forEach(fn) {
iterate(anObject(this), fn, { IS_ITERATOR: true });
iterate(getIteratorDirect(this), fn, { IS_RECORD: true });
}
});

@@ -10,2 +10,3 @@ // https://github.com/tc39/proposal-iterator-helpers

var getIterator = require('../internals/get-iterator');
var getIteratorDirect = require('../internals/get-iterator-direct');
var getIteratorMethod = require('../internals/get-iterator-method');

@@ -29,4 +30,4 @@

iterator = object;
} return new IteratorProxy({ iterator: iterator });
} return new IteratorProxy(getIteratorDirect(iterator));
}
});

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

var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var createIteratorProxy = require('../internals/iterator-create-proxy');

@@ -20,4 +21,3 @@ var callWithSafeIterationClosing = require('../internals/call-with-safe-iteration-closing');

map: function map(mapper) {
return new IteratorProxy({
iterator: anObject(this),
return new IteratorProxy(getIteratorDirect(this), {
mapper: aCallable(mapper)

@@ -24,0 +24,0 @@ });

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

var aCallable = require('../internals/a-callable');
var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');

@@ -13,7 +13,7 @@ var $TypeError = TypeError;

reduce: function reduce(reducer /* , initialValue */) {
anObject(this);
var record = getIteratorDirect(this);
aCallable(reducer);
var noInitial = arguments.length < 2;
var accumulator = noInitial ? undefined : arguments[1];
iterate(this, function (value) {
iterate(record, function (value) {
if (noInitial) {

@@ -25,3 +25,3 @@ noInitial = false;

}
}, { IS_ITERATOR: true });
}, { IS_RECORD: true });
if (noInitial) throw $TypeError('Reduce of empty iterator with no initial value');

@@ -28,0 +28,0 @@ return accumulator;

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

var aCallable = require('../internals/a-callable');
var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
$({ target: 'Iterator', proto: true, real: true, forced: true }, {
some: function some(fn) {
anObject(this);
var record = getIteratorDirect(this);
aCallable(fn);
return iterate(this, function (value, stop) {
return iterate(record, function (value, stop) {
if (fn(value)) return stop();
}, { IS_ITERATOR: true, INTERRUPTED: true }).stopped;
}, { IS_RECORD: true, INTERRUPTED: true }).stopped;
}
});

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

var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');
var toPositiveInteger = require('../internals/to-positive-integer');

@@ -24,4 +25,3 @@ var createIteratorProxy = require('../internals/iterator-create-proxy');

take: function take(limit) {
return new IteratorProxy({
iterator: anObject(this),
return new IteratorProxy(getIteratorDirect(this), {
remaining: toPositiveInteger(limit)

@@ -28,0 +28,0 @@ });

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

var iterate = require('../internals/iterate');
var anObject = require('../internals/an-object');
var getIteratorDirect = require('../internals/get-iterator-direct');

@@ -13,5 +13,5 @@ var push = [].push;

var result = [];
iterate(anObject(this), push, { that: result, IS_ITERATOR: true });
iterate(getIteratorDirect(this), push, { that: result, IS_RECORD: true });
return result;
}
});
'use strict';
var $ = require('../internals/export');
var global = require('../internals/global');
var getBuiltIn = require('../internals/get-built-in');

@@ -12,2 +13,3 @@ var createPropertyDescriptor = require('../internals/create-property-descriptor');

var clearErrorStack = require('../internals/clear-error-stack');
var DESCRIPTORS = require('../internals/descriptors');
var IS_PURE = require('../internals/is-pure');

@@ -36,4 +38,12 @@

var DOM_EXCEPTION_HAS_STACK = 'stack' in new NativeDOMException(1, 2);
var FORCED_CONSTRUCTOR = ERROR_HAS_STACK && !DOM_EXCEPTION_HAS_STACK;
// eslint-disable-next-line es-x/no-object-getownpropertydescriptor -- safe
var descriptor = NativeDOMException && DESCRIPTORS && Object.getOwnPropertyDescriptor(global, DOM_EXCEPTION);
// Bun ~ 0.1.1 DOMException have incorrect descriptor and we can't redefine it
// https://github.com/Jarred-Sumner/bun/issues/399
var BUGGY_DESCRIPTOR = !!descriptor && !(descriptor.writable && descriptor.configurable);
var FORCED_CONSTRUCTOR = ERROR_HAS_STACK && !BUGGY_DESCRIPTOR && !DOM_EXCEPTION_HAS_STACK;
// `DOMException` constructor patch for `.stack` where it's required

@@ -40,0 +50,0 @@ // https://webidl.spec.whatwg.org/#es-DOMException-specialness

@@ -72,3 +72,3 @@ var IS_PURE = require('../internals/is-pure');

var test = structuredCloneImplementation({ a: error, b: error });
return !(test && test.a === test.b && test.a instanceof $Error);
return !(test && test.a === test.b && test.a instanceof $Error && test.stack === error.stack);
});

@@ -86,4 +86,8 @@ };

// FF94+, Safari 15.4+, Chrome 98+, NodeJS 17.0+, Deno 1.13+
// FF and Safari implementations can't clone errors
// FF<103 and Safari implementations can't clone errors
// https://bugzilla.mozilla.org/show_bug.cgi?id=1556604
// FF103 can clone errors, but `.stack` of clone is an empty string
// https://bugzilla.mozilla.org/show_bug.cgi?id=1778762
// FF104+ fixed it on usual errors, but not on DOMExceptions
// https://bugzilla.mozilla.org/show_bug.cgi?id=1777321
// Chrome <102 returns `null` if cloned object contains multiple references to one error

@@ -93,3 +97,3 @@ // https://bugs.chromium.org/p/v8/issues/detail?id=12542

// https://github.com/nodejs/node/issues/41038
// no one of current implementations supports new (html/5749) error cloning semantic
// only FF103+ supports new (html/5749) error cloning semantic
var nativeStructuredClone = global.structuredClone;

@@ -112,3 +116,3 @@

// https://github.com/nodejs/node/issues/40840
// no one of current implementations supports new (html/5749) error cloning semantic
// no one of those implementations supports new (html/5749) error cloning semantic
var structuredCloneFromMark = !nativeStructuredClone && checkBasicSemantic(function (value) {

@@ -115,0 +119,0 @@ return new PerformanceMark(PERFORMANCE_MARK, { detail: value }).detail;

{
"name": "core-js",
"description": "Standard library",
"version": "3.23.3",
"version": "3.23.4",
"repository": {

@@ -6,0 +6,0 @@ "type": "git",

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc