https://github.com/es-shims/set.prototype.isdisjointfrom
An ESnext spec-compliant `Set.prototype.isDisjointFrom` shim/polyfill/replacement that works as far down as ES3
https://github.com/es-shims/set.prototype.isdisjointfrom
disjoint ecmascript es-shims isdisjointfrom javascript polyfill set shim
Last synced: about 1 month ago
JSON representation
An ESnext spec-compliant `Set.prototype.isDisjointFrom` shim/polyfill/replacement that works as far down as ES3
- Host: GitHub
- URL: https://github.com/es-shims/set.prototype.isdisjointfrom
- Owner: es-shims
- License: mit
- Created: 2022-12-05T21:06:41.000Z (over 2 years ago)
- Default Branch: main
- Last Pushed: 2024-09-10T17:34:25.000Z (9 months ago)
- Last Synced: 2025-05-07T12:54:58.847Z (about 1 month ago)
- Topics: disjoint, ecmascript, es-shims, isdisjointfrom, javascript, polyfill, set, shim
- Language: JavaScript
- Homepage:
- Size: 124 KB
- Stars: 3
- Watchers: 4
- Forks: 0
- Open Issues: 1
-
Metadata Files:
- Readme: README.md
- Changelog: CHANGELOG.md
- License: LICENSE
Awesome Lists containing this project
README
# set.prototype.isdisjointfrom [![Version Badge][npm-version-svg]][package-url]
[![github actions][actions-image]][actions-url]
[![coverage][codecov-image]][codecov-url]
[![License][license-image]][license-url]
[![Downloads][downloads-image]][downloads-url][![npm badge][npm-badge-png]][package-url]
ES Proposal spec-compliant shim for Set.prototype.isDisjointFrom. Invoke its "shim" method to shim `Set.prototype.isDisjointFrom` if it is unavailable or noncompliant.
This package implements the [es-shim API](https://github.com/es-shims/api) interface. It works in an ES3-supported environment, and complies with the [proposed spec](https://github.com/tc39/proposal-set-methods). When shimmed, it uses [`es-set`](https://npmjs.com/es-set) to shim the `Set` implementation itself if needed.
Most common usage:
```js
var assert = require('assert');
var isDisjointFrom = require('set.prototype.isdisjointfrom');var set1 = new Set([1, 2]);
var set2 = new Set([2, 3]);
var set3 = new Set([1]);assert.equal(isDisjointFrom(set1, set2), false);
assert.equal(isDisjointFrom(set2, set1), false);
assert.equal(isDisjointFrom(set1, set3), false);
assert.equal(isDisjointFrom(set2, set3), true);
assert.equal(isDisjointFrom(set3, set2), true);isDisjointFrom.shim();
assert.equal(set1.isDisjointFrom(set2), false);
assert.equal(set2.isDisjointFrom(set1), false);
assert.equal(set1.isDisjointFrom(set3), false);
assert.equal(set2.isDisjointFrom(set3), true);
assert.equal(set3.isDisjointFrom(set2), true);
```## Compatibility
node v22 and equivalent versions of Chrome have Set isDisjointFrom, but has a bug with set-like arguments with non-SMI integer sizes.## Tests
Simply clone the repo, `npm install`, and run `npm test`## Set Method Packages
- [union](https://npmjs.com/set.prototype.union)
- [intersection](https://npmjs.com/set.prototype.intersection)
- [difference](https://npmjs.com/set.prototype.difference)
- [symmetricDifference](https://npmjs.com/set.prototype.symmetricdifference)
- [isSubsetOf](https://npmjs.com/set.prototype.issubsetof)
- [isSupersetOf](https://npmjs.com/set.prototype.issupersetof)
- [isDisjointFrom](https://npmjs.com/set.prototype.isdisjointfrom)[package-url]: https://npmjs.com/package/set.prototype.isdisjointfrom
[npm-version-svg]: http://versionbadg.es/es-shims/Set.prototype.isDisjointFrom.svg
[deps-svg]: https://david-dm.org/es-shims/Set.prototype.isDisjointFrom.svg
[deps-url]: https://david-dm.org/es-shims/Set.prototype.isDisjointFrom
[dev-deps-svg]: https://david-dm.org/es-shims/Set.prototype.isDisjointFrom/dev-status.svg
[dev-deps-url]: https://david-dm.org/es-shims/Set.prototype.isDisjointFrom#info=devDependencies
[testling-svg]: https://ci.testling.com/es-shims/Set.prototype.isDisjointFrom.png
[testling-url]: https://ci.testling.com/es-shims/Set.prototype.isDisjointFrom
[npm-badge-png]: https://nodei.co/npm/set.prototype.isdisjointfrom.png?downloads=true&stars=true
[license-image]: http://img.shields.io/npm/l/set.prototype.isdisjointfrom.svg
[license-url]: LICENSE
[downloads-image]: http://img.shields.io/npm/dm/set.prototype.isdisjointfrom.svg
[downloads-url]: http://npm-stat.com/charts.html?package=set.prototype.isdisjointfrom
[codecov-image]: https://codecov.io/gh/es-shims/Set.prototype.isDisjointFrom/branch/main/graphs/badge.svg
[codecov-url]: https://app.codecov.io/gh/es-shims/Set.prototype.isDisjointFrom/
[actions-image]: https://img.shields.io/endpoint?url=https://github-actions-badge-u3jn4tfpocch.runkit.sh/es-shims/Set.prototype.isDisjointFrom
[actions-url]: https://github.com/es-shims/Set.prototype.isDisjointFrom/actions