set.prototype.intersection
Advanced tools
Comparing version 1.0.1 to 1.0.2
@@ -8,2 +8,8 @@ # Changelog | ||
## [v1.0.2](https://github.com/es-shims/Set.prototype.intersection/compare/v1.0.1...v1.0.2) - 2023-01-14 | ||
### Commits | ||
- [Refactor] update `es-set`; use `es-set/tools` [`f2a2f98`](https://github.com/es-shims/Set.prototype.intersection/commit/f2a2f98c744155c672275a02d607bf2673edbca8) | ||
## [v1.0.1](https://github.com/es-shims/Set.prototype.intersection/compare/v1.0.0...v1.0.1) - 2023-01-13 | ||
@@ -10,0 +16,0 @@ |
@@ -11,4 +11,2 @@ 'use strict'; | ||
var isNativeSet = typeof Set === 'function' && $Set === Set; | ||
var Call = require('es-abstract/2022/Call'); | ||
@@ -18,3 +16,2 @@ var IteratorStep = require('es-abstract/2022/IteratorStep'); | ||
var ToBoolean = require('es-abstract/2022/ToBoolean'); | ||
var gOPD = require('es-abstract/helpers/getOwnPropertyDescriptor'); | ||
// var forEach = require('es-abstract/helpers/forEach'); | ||
@@ -28,49 +25,7 @@ | ||
var callBind = require('call-bind'); | ||
var callBound = require('call-bind/callBound'); | ||
var iterate = require('iterate-value'); | ||
var tools = require('es-set/tools'); | ||
var $setForEach = tools.forEach; | ||
var $setAdd = tools.add; | ||
var $setSize = tools.size; | ||
var $nativeSetForEach = callBound('Set.prototype.forEach', true); | ||
var $polyfillSetForEach = $Set.prototype.forEach && callBind($Set.prototype.forEach); | ||
var $setForEach = function (set, callback) { | ||
if ($nativeSetForEach) { | ||
try { | ||
return $nativeSetForEach(set, callback); | ||
} catch (e) { /**/ } | ||
} | ||
if ($polyfillSetForEach) { | ||
return $polyfillSetForEach(set, callback); | ||
} | ||
iterate(set, callback); | ||
return void undefined; | ||
}; | ||
// var $nativeSetHas = callBound('Set.prototype.has', true); | ||
// var $polyfillSetHas = $Set.prototype.has && callBind($Set.prototype.has); | ||
// var $setHas = function (set, key) { | ||
// if ($nativeSetHas) { | ||
// try { | ||
// return $nativeSetHas(set, key); | ||
// } catch (e) { /**/ } | ||
// } | ||
// return $polyfillSetHas(set, key); | ||
// }; | ||
var $nativeSetAdd = callBound('Set.prototype.add', true); | ||
var $polyfillSetAdd = $Set.prototype.add && callBind($Set.prototype.add); | ||
var $setAdd = function (S, v) { | ||
if ($nativeSetAdd) { | ||
try { | ||
return $nativeSetAdd(S, v); | ||
} catch (e) { /**/ } | ||
} | ||
return $polyfillSetAdd(S, v); | ||
}; | ||
var $setSize = isNativeSet ? callBound('Set.prototype.size') : gOPD ? callBind(gOPD($Set.prototype, 'size').get) : function setSize(set) { | ||
var count = 0; | ||
$setForEach(set, function () { | ||
count += 1; | ||
}); | ||
return count; | ||
}; | ||
/* | ||
@@ -77,0 +32,0 @@ var $push = callBound('Array.prototype.push'); |
{ | ||
"name": "set.prototype.intersection", | ||
"version": "1.0.1", | ||
"version": "1.0.2", | ||
"description": "An ESnext spec-compliant `Set.prototype.intersection` shim/polyfill/replacement that works as far down as ES3", | ||
@@ -66,6 +66,5 @@ "main": "index.js", | ||
"es-abstract": "^1.21.1", | ||
"es-set": "^1.0.3", | ||
"es-set": "^1.1.0", | ||
"get-intrinsic": "^1.1.3", | ||
"is-set": "^2.0.2", | ||
"iterate-value": "^1.0.2", | ||
"stop-iteration-iterator": "^1.0.0" | ||
@@ -72,0 +71,0 @@ }, |
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
7
27424
503
- Removediterate-value@^1.0.2
Updatedes-set@^1.1.0