🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

es6set-operations

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

es6set-operations - npm Package Compare versions

Comparing version

to
0.0.2

15

lib/index.js
// All elements of A (this) that also belong to B (other)
function intersection(other) {
var self = this;
function intersection(set, other) {
return new Set(other.toArray().filter(function(value) {
return self.has(value);
return set.has(value);
}));

@@ -11,12 +10,11 @@ }

// Returns the set of objects in other (B) but not in this (A)
function difference(other) {
var self = this;
function difference(set, other) {
return new Set(other.toArray().filter(function(value) {
return !self.has(value);
return !set.has(value);
}));
}
function toArray() {
function toArray(set) {
var array = [];
this.forEach(function(value) {
set.forEach(function(value) {
array.push(value);

@@ -27,2 +25,3 @@ });

module.exports = {

@@ -29,0 +28,0 @@ toArray: toArray,

{
"name": "es6set-operations",
"version": "0.0.1",
"version": "0.0.2",
"description": "Set operations for ES6 sets",

@@ -5,0 +5,0 @@ "main": "lib/index.js",