Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Socket
Sign inDemoInstall

set.prototype.intersection

Package Overview
Dependencies
Maintainers
1
Versions
11
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

set.prototype.intersection

An ESnext spec-compliant `Set.prototype.intersection` shim/polyfill/replacement that works as far down as ES3


Version published
Weekly downloads
1.2K
decreased by-6.77%
Maintainers
1
Weekly downloads
 
Created
Source

set.prototype.intersection Version Badge

github actions coverage License Downloads

npm badge

ES Proposal spec-compliant shim for Set.prototype.intersection. Invoke its "shim" method to shim Set.prototype.intersection if it is unavailable or noncompliant.

This package implements the es-shim API interface. It works in an ES3-supported environment, and complies with the proposed spec. When shimmed, it uses es-set to shim the Set implementation itself if needed.

Most common usage:

var assert = require('assert');
var intersection = require('set.prototype.intersection');

var set1 = new Set([1, 2]);
var set2 = new Set([2, 3]);
var result = intersection(set1, set2);

assert.deepEqual(result, new Set([2]));

intersection.shim();

var shimmedResult = set1.intersection(set2);
assert.deepEqual(shimmedResult, new Set([2]));

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

Simply clone the repo, npm install, and run npm test

Keywords

FAQs

Package last updated on 10 Sep 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc