set.prototype.intersection
Advanced tools
Comparing version 1.1.5 to 1.1.6
@@ -56,3 +56,3 @@ 'use strict'; | ||
return { '[[Set]]': obj, '[[Size]]': intSize, '[[Has]]': has, '[[Keys]]': keys }; // step 12 | ||
return { '[[SetObject]]': obj, '[[Size]]': intSize, '[[Has]]': has, '[[Keys]]': keys }; // step 12 | ||
}; |
@@ -8,2 +8,12 @@ # Changelog | ||
## [v1.1.6](https://github.com/es-shims/Set.prototype.intersection/compare/v1.1.5...v1.1.6) - 2024-09-09 | ||
### Commits | ||
- [Fix] `node` `v22` and equivalent Chrome versions have a bug [`2024f8c`](https://github.com/es-shims/Set.prototype.intersection/commit/2024f8c63ce84973353e78e192de01c305e9234a) | ||
- [Dev Deps] update `@es-shims/api`, `@ljharb/eslint-config`, `object-inspect`, `tape` [`d50a71b`](https://github.com/es-shims/Set.prototype.intersection/commit/d50a71b1c1dd9881d2ce6fed56ba1834b9880ead) | ||
- [Refactor] change internal slot name [`f3eea84`](https://github.com/es-shims/Set.prototype.intersection/commit/f3eea843706163313c63351e7b148a738ec08af4) | ||
- [Tests] replace `aud` with `npm audit` [`fba1b9c`](https://github.com/es-shims/Set.prototype.intersection/commit/fba1b9c6646607e5278fda134fe9443136e4a2d9) | ||
- [Dev Deps] add missing peer dep [`047c8e0`](https://github.com/es-shims/Set.prototype.intersection/commit/047c8e0896b214f25a6c7037657435f95cd340ff) | ||
## [v1.1.5](https://github.com/es-shims/Set.prototype.intersection/compare/v1.1.4...v1.1.5) - 2024-04-06 | ||
@@ -10,0 +20,0 @@ |
@@ -48,3 +48,3 @@ 'use strict'; | ||
index += 1; // step 5.c.ii | ||
var inOther = ToBoolean(Call(otherRec['[[Has]]'], otherRec['[[Set]]'], [e])); // step 5.c.iii.1 | ||
var inOther = ToBoolean(Call(otherRec['[[Has]]'], otherRec['[[SetObject]]'], [e])); // step 5.c.iii.1 | ||
if (inOther) { // step 6.c.iii.2 | ||
@@ -60,3 +60,3 @@ var alreadyInResult = SetDataHas(resultSetData, e); // step 5.c.iii.2.b | ||
} else { // step 6 | ||
var keysIter = GetIteratorFromMethod(otherRec['[[Set]]'], otherRec['[[Keys]]']); // step 6.a | ||
var keysIter = GetIteratorFromMethod(otherRec['[[SetObject]]'], otherRec['[[Keys]]']); // step 6.a | ||
var next; // step 6.b | ||
@@ -63,0 +63,0 @@ while (!keysIter['[[Done]]']) { // step 6.c |
{ | ||
"name": "set.prototype.intersection", | ||
"version": "1.1.5", | ||
"version": "1.1.6", | ||
"description": "An ESnext spec-compliant `Set.prototype.intersection` shim/polyfill/replacement that works as far down as ES3", | ||
@@ -25,3 +25,3 @@ "main": "index.js", | ||
"test": "npm run tests-only", | ||
"posttest": "aud --production", | ||
"posttest": "npx npm@'>=10.2' audit --production", | ||
"version": "auto-changelog && git add CHANGELOG.md", | ||
@@ -64,6 +64,6 @@ "postversion": "auto-changelog && git add CHANGELOG.md && git commit --no-edit --amend && git tag -f \"v$(node -e \"console.log(require('./package.json').version)\")\"" | ||
"devDependencies": { | ||
"@es-shims/api": "^2.5.0", | ||
"@ljharb/eslint-config": "^21.1.0", | ||
"aud": "^2.0.4", | ||
"@es-shims/api": "^2.5.1", | ||
"@ljharb/eslint-config": "^21.1.1", | ||
"auto-changelog": "^2.4.0", | ||
"encoding": "^0.1.13", | ||
"es-get-iterator": "^1.1.3", | ||
@@ -82,5 +82,5 @@ "es-map": "^1.0.5", | ||
"nyc": "^10.3.2", | ||
"object-inspect": "^1.13.1", | ||
"object-inspect": "^1.13.2", | ||
"safe-publish-latest": "^2.0.0", | ||
"tape": "^5.7.5" | ||
"tape": "^5.8.1" | ||
}, | ||
@@ -87,0 +87,0 @@ "testling": { |
@@ -8,3 +8,20 @@ 'use strict'; | ||
module.exports = function getPolyfill() { | ||
return typeof Set.prototype.intersection === 'function' ? Set.prototype.intersection : implementation; | ||
if (typeof Set.prototype.intersection === 'function') { | ||
var called = false; | ||
var setLike = { | ||
size: Infinity, | ||
has: function () {}, | ||
keys: function () { | ||
called = true; | ||
return [].values(); | ||
} | ||
}; | ||
new Set([1]).intersection(setLike); | ||
if (!called) { | ||
return Set.prototype.intersection; | ||
} | ||
} | ||
return implementation; | ||
}; |
@@ -31,2 +31,5 @@ # set.prototype.intersection <sup>[![Version Badge][npm-version-svg]][package-url]</sup> | ||
## Compatibility | ||
node v22 and equivalent versions of Chrome have Set intersection, but has a bug with set-like arguments with non-SMI integer sizes. | ||
## Tests | ||
@@ -33,0 +36,0 @@ Simply clone the repo, `npm install`, and run `npm test` |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
39117
709
54