Socket
Socket
Sign inDemoInstall

es-iterator-helpers

Package Overview
Dependencies
Maintainers
1
Versions
20
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es-iterator-helpers - npm Package Compare versions

Comparing version 1.0.18 to 1.0.19

8

CHANGELOG.md

@@ -8,2 +8,10 @@ # Changelog

## [v1.0.19](https://github.com/es-shims/iterator-helpers/compare/v1.0.18...v1.0.19) - 2024-04-24
### Commits
- [patch] remove unused AOs [`698cef7`](https://github.com/es-shims/iterator-helpers/commit/698cef79757378a74500690d5a5dc2a6b86cd304)
- [Fix] `drop`, `filter`, `flatMap`, `map`: rpatch a v8 bug when polyfilling [`3670395`](https://github.com/es-shims/iterator-helpers/commit/36703956321c201933c4c701c78304669a46947b)
- [Deps] update `es-abstract` [`d2b47a5`](https://github.com/es-shims/iterator-helpers/commit/d2b47a5f46d3f874aad67375346cb58bf8c9e8b2)
## [v1.0.18](https://github.com/es-shims/iterator-helpers/compare/v1.0.17...v1.0.18) - 2024-03-15

@@ -10,0 +18,0 @@

12

Iterator.prototype.drop/polyfill.js

@@ -6,5 +6,11 @@ 'use strict';

module.exports = function getPolyfill() {
return typeof Iterator === 'function' && typeof Iterator.prototype.drop === 'function'
? Iterator.prototype.drop
: implementation;
if (typeof Iterator === 'function' && typeof Iterator.prototype.drop === 'function') {
try {
// https://issues.chromium.org/issues/336839115
Iterator.prototype.drop.call({ next: null }, 0).next();
} catch (e) {
return Iterator.prototype.drop;
}
}
return implementation;
};

@@ -6,5 +6,11 @@ 'use strict';

module.exports = function getPolyfill() {
return typeof Iterator === 'function' && typeof Iterator.prototype.filter === 'function'
? Iterator.prototype.filter
: implementation;
if (typeof Iterator === 'function' && typeof Iterator.prototype.filter === 'function') {
try {
// https://issues.chromium.org/issues/336839115
Iterator.prototype.filter.call({ next: null }, function () {}).next();
} catch (e) {
return Iterator.prototype.filter;
}
}
return implementation;
};

@@ -6,5 +6,11 @@ 'use strict';

module.exports = function getPolyfill() {
return typeof Iterator === 'function' && typeof Iterator.prototype.flatMap === 'function'
? Iterator.prototype.flatMap
: implementation;
if (typeof Iterator === 'function' && typeof Iterator.prototype.flatMap === 'function') {
try {
// https://issues.chromium.org/issues/336839115
Iterator.prototype.flatMap.call({ next: null }, function () {}).next();
} catch (e) {
return Iterator.prototype.flatMap;
}
}
return implementation;
};

@@ -6,5 +6,11 @@ 'use strict';

module.exports = function getPolyfill() {
return typeof Iterator === 'function' && typeof Iterator.prototype.map === 'function'
? Iterator.prototype.map
: implementation;
if (typeof Iterator === 'function' && typeof Iterator.prototype.map === 'function') {
try {
// https://issues.chromium.org/issues/336839115
Iterator.prototype.map.call({ next: null }, function () {}).next();
} catch (e) {
return Iterator.prototype.map;
}
}
return implementation;
};
{
"name": "es-iterator-helpers",
"version": "1.0.18",
"version": "1.0.19",
"description": "An ESnext spec-compliant iterator helpers shim/polyfill/replacement that works as far down as ES3.",

@@ -136,3 +136,3 @@ "main": "index.json",

"define-properties": "^1.2.1",
"es-abstract": "^1.23.0",
"es-abstract": "^1.23.3",
"es-errors": "^1.3.0",

@@ -139,0 +139,0 @@ "es-set-tostringtag": "^2.0.3",

@@ -36,2 +36,7 @@ # es-iterator-helpers <sup>[![Version Badge][npm-version-svg]][package-url]</sup>

## Environments where this is needed
- node v22, Chrome >= v122: has a [bug](https://issues.chromium.org/issues/336839115)
- node < v22, Chrome < v122, Safari <= v17.1, Firefox <= v125: not implemented
## Getting started

@@ -38,0 +43,0 @@

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

var hasPropertyDescriptors = require('has-property-descriptors')();
var iterate = require('iterate-iterator');

@@ -34,3 +35,3 @@ var index = require('../Iterator.prototype.every');

t['throws'](
function () { every(nonIterator); },
function () { iterate(every(nonIterator, function () {})); },
TypeError,

@@ -42,3 +43,3 @@ debug(nonIterator) + ' is not an Object with a callable `next` method'

t['throws'](
function () { every(badNext); },
function () { iterate(every(badNext, function () {})); },
TypeError,

@@ -45,0 +46,0 @@ debug(badNext) + ' is not an Object with a callable `next` method'

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

var hasPropertyDescriptors = require('has-property-descriptors')();
var iterate = require('iterate-iterator');

@@ -34,3 +35,3 @@ var index = require('../Iterator.prototype.filter');

t['throws'](
function () { filter(nonIterator); },
function () { iterate(filter(nonIterator, function () {})); },
TypeError,

@@ -42,3 +43,3 @@ debug(nonIterator) + ' is not an Object with a callable `next` method'

t['throws'](
function () { filter(badNext); },
function () { iterate(filter(badNext, function () {})); },
TypeError,

@@ -45,0 +46,0 @@ debug(badNext) + ' is not an Object with a callable `next` method'

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

var hasSymbols = require('has-symbols/shams')();
var iterate = require('iterate-iterator');

@@ -33,3 +34,3 @@ var index = require('../Iterator.prototype.find');

t['throws'](
function () { find(nonIterator); },
function () { iterate(find(nonIterator, function () {})); },
TypeError,

@@ -41,3 +42,3 @@ debug(nonIterator) + ' is not an Object with a callable `next` method'

t['throws'](
function () { find(badNext); },
function () { iterate(find(badNext, function () {})); },
TypeError,

@@ -44,0 +45,0 @@ debug(badNext) + ' is not an Object with a callable `next` method'

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

var hasSymbols = require('has-symbols/shams')();
var iterate = require('iterate-iterator');

@@ -35,3 +36,3 @@ var StringToCodePoints = require('es-abstract/2024/StringToCodePoints');

t['throws'](
function () { flatMap(nonIterator); },
function () { iterate(flatMap(nonIterator, function () {})); },
TypeError,

@@ -43,3 +44,3 @@ debug(nonIterator) + ' is not an Object with a callable `next` method'

t['throws'](
function () { flatMap(badNext); },
function () { iterate(flatMap(badNext, function () {})); },
TypeError,

@@ -46,0 +47,0 @@ debug(badNext) + ' is not an Object with a callable `next` method'

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

var hasSymbols = require('has-symbols/shams')();
var iterate = require('iterate-iterator');

@@ -33,3 +34,3 @@ var index = require('../Iterator.prototype.forEach');

t['throws'](
function () { forEach(nonIterator); },
function () { iterate(forEach(nonIterator, function () {})); },
TypeError,

@@ -41,3 +42,3 @@ debug(nonIterator) + ' is not an Object with a callable `next` method'

t['throws'](
function () { forEach(badNext); },
function () { iterate(forEach(badNext, function () {})); },
TypeError,

@@ -44,0 +45,0 @@ debug(badNext) + ' is not an Object with a callable `next` method'

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

var generators = require('make-generator-function')();
var iterate = require('iterate-iterator');

@@ -34,3 +35,3 @@ var index = require('../Iterator.prototype.map');

t['throws'](
function () { map(nonIterator); },
function () { iterate(map(nonIterator, function () {})); },
TypeError,

@@ -42,3 +43,3 @@ debug(nonIterator) + ' is not an Object with a callable `next` method'

t['throws'](
function () { map(badNext); },
function () { iterate(map(badNext, function () {})); },
TypeError,

@@ -45,0 +46,0 @@ debug(badNext) + ' is not an Object with a callable `next` method'

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

var hasSymbols = require('has-symbols/shams')();
var iterate = require('iterate-iterator');

@@ -33,3 +34,3 @@ var index = require('../Iterator.prototype.reduce');

t['throws'](
function () { reduce(nonIterator); },
function () { iterate(reduce(nonIterator, function () {})); },
TypeError,

@@ -41,3 +42,3 @@ debug(nonIterator) + ' is not an Object with a callable `next` method'

t['throws'](
function () { reduce(badNext); },
function () { iterate(reduce(badNext, function () {})); },
TypeError,

@@ -44,0 +45,0 @@ debug(badNext) + ' is not an Object with a callable `next` method'

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

var hasSymbols = require('has-symbols/shams')();
var iterate = require('iterate-iterator');

@@ -33,3 +34,3 @@ var index = require('../Iterator.prototype.some');

t['throws'](
function () { some(nonIterator); },
function () { iterate(some(nonIterator, function () {})); },
TypeError,

@@ -41,3 +42,3 @@ debug(nonIterator) + ' is not an Object with a callable `next` method'

t['throws'](
function () { some(badNext); },
function () { iterate(some(badNext, function () {})); },
TypeError,

@@ -44,0 +45,0 @@ debug(badNext) + ' is not an Object with a callable `next` method'

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

var hasSymbols = require('has-symbols/shams')();
var iterate = require('iterate-iterator');

@@ -33,3 +34,3 @@ var index = require('../Iterator.prototype.take');

t['throws'](
function () { take(nonIterator, 1).next(); },
function () { iterate(take(nonIterator, 1)); },
TypeError,

@@ -42,3 +43,3 @@ debug(nonIterator) + ' is not an Object with a callable `next` method'

t['throws'](
function () { take(badNext, 1).next(); },
function () { iterate(take(badNext, 1)); },
TypeError,

@@ -45,0 +46,0 @@ debug(badNext) + ' is not an Object with a callable `next` method'

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

var hasSymbols = require('has-symbols/shams')();
var iterate = require('iterate-iterator');

@@ -33,3 +34,3 @@ var index = require('../Iterator.prototype.toArray');

t['throws'](
function () { toArray(nonIterator); },
function () { iterate(toArray(nonIterator)); },
TypeError,

@@ -41,3 +42,3 @@ debug(nonIterator) + ' is not an Object with a callable `next` method'

t['throws'](
function () { toArray(badNext); },
function () { iterate(toArray(badNext)); },
TypeError,

@@ -44,0 +45,0 @@ debug(badNext) + ' is not an Object with a callable `next` method'

Sorry, the diff of this file is not supported yet

SocketSocket SOC 2 Logo

Product

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

Packages

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc