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.11 to 1.0.12

6

aos/GetIteratorFlattenable.js

@@ -16,5 +16,7 @@ 'use strict';

module.exports = function GetIteratorFlattenable(obj) {
module.exports = function GetIteratorFlattenable(obj, stringHandling) {
if (Type(obj) !== 'Object') {
throw new $TypeError('obj must be an Object'); // step 1
if (stringHandling === 'reject-strings' || typeof obj !== 'string') {
throw new $TypeError('obj must be an Object'); // step 1.a
}
}

@@ -21,0 +23,0 @@

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

## [v1.0.12](https://github.com/es-shims/iterator-helpers/compare/v1.0.11...v1.0.12) - 2023-07-14
### Commits
- [Fix] avoid creating string wrapper objects with sloppy mode flatMap mappers [`db16b34`](https://github.com/es-shims/iterator-helpers/commit/db16b34aec554934ec2bfd62629fb66cebc311f8)
- [Deps] update `es-abstract` [`f002147`](https://github.com/es-shims/iterator-helpers/commit/f002147f0afbb2cd7c2d2e1207685f52e33abf0f)
- [Dev Deps] update `@ljharb/eslint-config`, `aud [`42064e8`](https://github.com/es-shims/iterator-helpers/commit/42064e80e0cc37f5e4676c2133dacae7456e313f)
- [meta] fix tidelift funding identifier [`896fd4f`](https://github.com/es-shims/iterator-helpers/commit/896fd4f2e4b419945bfbd85024a2c96248323151)
## [v1.0.11](https://github.com/es-shims/iterator-helpers/compare/v1.0.10...v1.0.11) - 2023-05-22

@@ -10,0 +19,0 @@

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

var OrdinaryObjectCreate = require('es-abstract/2022/OrdinaryObjectCreate');
var ToObject = require('es-abstract/2022/ToObject');
var Type = require('es-abstract/2022/Type');

@@ -25,20 +23,15 @@ var GetIteratorFlattenable = require('../aos/GetIteratorFlattenable');

if (Type(O) === 'String') {
// eslint-disable-next-line no-param-reassign
O = ToObject(O); // step 1
}
var iteratorRecord = GetIteratorFlattenable(O, 'iterate-strings'); // step 1
var iteratorRecord = GetIteratorFlattenable(O); // step 2
var hasInstance = OrdinaryHasInstance($Iterator, iteratorRecord['[[Iterator]]']); // step 2
var hasInstance = OrdinaryHasInstance($Iterator, iteratorRecord['[[Iterator]]']); // step 3
if (hasInstance) { // step 4
return iteratorRecord['[[Iterator]]']; // step 4.a
if (hasInstance) { // step 3
return iteratorRecord['[[Iterator]]']; // step 3.a
}
var wrapper = OrdinaryObjectCreate($WrapForValidIteratorPrototype); // , ['[[Iterated]]']); // step 5
var wrapper = OrdinaryObjectCreate($WrapForValidIteratorPrototype); // , ['[[Iterated]]']); // step 4
SLOT.set(wrapper, '[[Iterated]]', iteratorRecord); // step 6
SLOT.set(wrapper, '[[Iterated]]', iteratorRecord); // step 5
return wrapper; // step 7
return wrapper; // step 6
};

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

// yield mapped // step 5.b.vi
innerIterator = GetIteratorFlattenable(mapped); // step 5.b.vi
innerIterator = GetIteratorFlattenable(mapped, 'reject-strings'); // step 5.b.vi
} catch (e) {

@@ -86,0 +86,0 @@ innerAlive = false;

{
"name": "es-iterator-helpers",
"version": "1.0.11",
"version": "1.0.12",
"description": "An ESnext spec-compliant iterator helpers shim/polyfill/replacement that works as far down as ES3.",

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

"asynciterator.prototype": "^1.0.0",
"es-abstract": "^1.21.2",
"es-abstract": "^1.21.3",
"es-set-tostringtag": "^2.0.1",

@@ -143,3 +143,3 @@ "function-bind": "^1.1.1",

"@es-shims/api": "^2.4.2",
"@ljharb/eslint-config": "^21.0.1",
"@ljharb/eslint-config": "^21.1.0",
"aud": "^2.0.2",

@@ -155,2 +155,3 @@ "auto-changelog": "^2.4.0",

"iterate-iterator": "^1.0.2",
"mock-property": "^1.0.0",
"npmignore": "^0.3.0",

@@ -157,0 +158,0 @@ "nyc": "^10.3.2",

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

var hasSymbols = require('has-symbols/shams')();
var mockProperty = require('mock-property');

@@ -108,2 +109,22 @@ var index = require('../Iterator.from');

st.test('observability in a replaced String iterator', function (s2t) {
var originalStringIterator = String.prototype[Symbol.iterator];
var observedType;
s2t.teardown(mockProperty(String.prototype, Symbol.iterator, {
get: function () {
'use strict'; // eslint-disable-line strict, lines-around-directive
observedType = typeof this;
return originalStringIterator;
}
}));
from('');
s2t.equal(observedType, 'string', 'string primitive -> primitive receiver in Symbol.iterator getter');
from(Object(''));
s2t.equal(observedType, 'object', 'boxed string -> boxed string in Symbol.iterator getter');
s2t.end();
});
st.end();

@@ -110,0 +131,0 @@ });

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