{"id":23350842,"url":"https://github.com/kubikowski/set-utilities","last_synced_at":"2026-03-09T15:04:06.694Z","repository":{"id":59932892,"uuid":"540085958","full_name":"kubikowski/set-utilities","owner":"kubikowski","description":"High performance set theory - functional utilities which operate on arbitrary input sets.","archived":false,"fork":false,"pushed_at":"2024-06-09T03:56:38.000Z","size":578,"stargazers_count":5,"open_issues_count":0,"forks_count":2,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-10-08T11:49:58.398Z","etag":null,"topics":["difference","disjoint","equivalence","intersection","math","set","set-theory","sets","subset","superset","typescript","union"],"latest_commit_sha":null,"homepage":"https://www.npmjs.com/package/set-utilities","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/kubikowski.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":"CODE_OF_CONDUCT.md","threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":"SECURITY.md","support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2022-09-22T17:07:01.000Z","updated_at":"2024-06-09T03:35:10.000Z","dependencies_parsed_at":"2024-05-31T01:25:34.303Z","dependency_job_id":"bc6b6f5d-1cc9-4a11-9eaa-83da967dba6c","html_url":"https://github.com/kubikowski/set-utilities","commit_stats":{"total_commits":108,"total_committers":3,"mean_commits":36.0,"dds":"0.20370370370370372","last_synced_commit":"f875a54333c921c4490bb191bbc3e9dc42d98a47"},"previous_names":[],"tags_count":18,"template":false,"template_full_name":null,"purl":"pkg:github/kubikowski/set-utilities","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubikowski%2Fset-utilities","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubikowski%2Fset-utilities/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubikowski%2Fset-utilities/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubikowski%2Fset-utilities/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/kubikowski","download_url":"https://codeload.github.com/kubikowski/set-utilities/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/kubikowski%2Fset-utilities/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":30299884,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-03-09T14:33:48.460Z","status":"ssl_error","status_checked_at":"2026-03-09T14:33:48.027Z","response_time":61,"last_error":"SSL_read: unexpected eof while reading","robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":false,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["difference","disjoint","equivalence","intersection","math","set","set-theory","sets","subset","superset","typescript","union"],"created_at":"2024-12-21T08:18:56.458Z","updated_at":"2026-03-09T15:04:06.665Z","avatar_url":"https://github.com/kubikowski.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ![set utilities][]\n\n[![NPM Version][]][npm]\n[![MIT License][]][license]\n[![FOSSA Status][]][fossa]\n\n[![Build \u0026 Test Job][]][github build test]\n[![Scale Test Job][]][github scale test]\n[![Coverage][]][coveralls]\n\n[![Install Size][]][package phobia]\n[![Zipped Size][]][bundle phobia]\n[![Language][]][typescript]\n\nHigh performance set theory.\n\nThis library is a collection of functional utilities from set theory,\neach of which operate on an arbitrary number of input sets.\n\nEach function accepts variable arguments and operates with the principals of immutability:\nnone of the input sets are modified in the process of calculation.\n\n\n## Set Operations:\n\n### difference: `A ∖ B`\nThe difference of sets contains all the elements\nof the first set, not contained in other sets.\n\n![difference visual][]\n```typescript\nimport { difference } from 'set-utilities';\n\nconst differenceAB = difference(setA, setB);\nconst differenceABC = difference(setA, setB, setC);\n```\n\n### intersection: `A ∩ B`\nThe intersection of sets contains all the elements\neach contained in every set.\n\n![intersection visual][]\n```typescript\nimport { intersection } from 'set-utilities';\n\nconst intersectionAB = intersection(setA, setB);\nconst intersectionABC = intersection(setA, setB, setC);\n```\n\n### union: `A ∪ B`\nThe union of sets contains all the elements\neach contained in any set.\n\n![union visual][]\n```typescript\nimport { union } from 'set-utilities';\n\nconst unionAB = union(setA, setB);\nconst unionABC = union(setA, setB, setC);\n```\n\n### symmetric difference _(xor)_: `A ∆ B`\nThe symmetric difference of sets contains\nonly the unique elements of each set.\n\n![xor visual][]\n```typescript\nimport { xor } from 'set-utilities';\n\nconst xorAB = xor(setA, setB);\nconst xorABC = xor(setA, setB, setC);\n```\n\n\n## Set Comparisons:\n\n### equivalence: `A ∼ B`\nSets are equivalent if they have the same cardinality,\nand there is a bijection between the elements contained in each set.\n\n![equivalence visual][]\n```typescript\nimport { equivalence } from 'set-utilities';\n\nconst isEquivalentAB = equivalence(setA, setB);\nconst isEquivalentABC = equivalence(setA, setB, setC);\n```\n\n### disjoint: `A ∩ B = ∅`\nSets are disjoint if they have no elements in common.\n\n![disjoint visual][]\n```typescript\nimport { disjoint } from 'set-utilities';\n\nconst isDisjointAB = disjoint(setA, setB);\nconst isDisjointABC = disjoint(setA, setB, setC);\n```\n\n### pairwise disjoint: `A ∩ B ∩ C = ∅`\nA family of sets are pairwise disjoint if\nnone of the sets share any elements in common.\n\n![pairwise disjoint visual][]\n```typescript\nimport { pairwiseDisjoint } from 'set-utilities';\n\nconst isPairwiseDisjointAB = pairwiseDisjoint(setA, setB);\nconst isPairwiseDisjointABC = pairwiseDisjoint(setA, setB, setC);\n```\n\n### subset: `A ⊆ B`\nA set is a subset of another if all of its elements\nare contained in the other set.\n\n![subset visual][]\n```typescript\nimport { subset } from 'set-utilities';\n\nconst isSubsetAB = subset(setA, setB);\nconst isSubsetABC = subset(setA, setB, setC);\n```\n\n### proper subset: `A ⊂ B`\nA set is a proper subset of another if all of its elements\nare contained in the other set,\nand it has a lower cardinality than the other set.\n\n![proper subset visual][]\n```typescript\nimport { properSubset } from 'set-utilities';\n\nconst isProperSubsetAB = properSubset(setA, setB);\nconst isProperSubsetABC = properSubset(setA, setB, setC);\n```\n\n### superset: `A ⊇ B`\nA set is a superset of another if it contains\nall the elements contained in the other set.\n\n![superset visual][]\n```typescript\nimport { superset } from 'set-utilities';\n\nconst isSupersetAB = superset(setA, setB);\nconst isSupersetABC = superset(setA, setB, setC);\n```\n\n### proper superset: `A ⊃ B`\nA set is a proper superset of another if it contains\nall the elements contained in the other set,\nand it has a greater cardinality than the other set.\n\n![proper superset visual][]\n```typescript\nimport { properSuperset } from 'set-utilities';\n\nconst isProperSupersetAB = properSuperset(setA, setB);\nconst isProperSupersetABC = properSuperset(setA, setB, setC);\n```\n\n\n## Set Ordering:\n\n### sort: `A ⇅`\nAn immutable sorting operation for sets.\n\n![sort visual][]\n```typescript\nimport { sort } from 'set-utilities';\n\nconst sortedA = sort(setA);\nconst sortedB = sort(setB, compareFunction);\n```\n\n\n\u003c!-- Badges --\u003e\n\n[NPM Version]: https://img.shields.io/npm/v/set-utilities\n[npm]: https://www.npmjs.org/package/set-utilities\n\n[MIT License]: https://img.shields.io/npm/l/set-utilities?color=blue\n[license]: LICENSE\n\n[FOSSA Status]: https://app.fossa.com/api/projects/git%2Bgithub.com%2Fkubikowski%2Fset-utilities.svg?type=shield\n[fossa]: https://app.fossa.com/projects/git%2Bgithub.com%2Fkubikowski%2Fset-utilities?ref=badge_shield\n\n[Build \u0026 Test Job]: https://github.com/kubikowski/set-utilities/actions/workflows/test.yml/badge.svg\n[github build test]: https://github.com/kubikowski/set-utilities/actions/workflows/test.yml\n\n[Scale Test Job]: https://github.com/kubikowski/set-utilities/actions/workflows/scale-test.yml/badge.svg\n[github scale test]: https://github.com/kubikowski/set-utilities/actions/workflows/scale-test.yml\n\n[Coverage]: https://coveralls.io/repos/github/kubikowski/set-utilities/badge.svg?branch=main\n[coveralls]: https://coveralls.io/github/kubikowski/set-utilities?branch=main\n\n[Install Size]: https://packagephobia.com/badge?p=set-utilities\n[package phobia]: https://packagephobia.com/result?p=set-utilities\n\n[Zipped Size]: https://img.shields.io/bundlephobia/minzip/set-utilities?color=success\n[bundle phobia]: https://bundlephobia.com/package/set-utilities\n\n[Language]: https://img.shields.io/github/languages/top/kubikowski/set-utilities\n[typescript]: https://www.typescriptlang.org\n\n\n\u003c!-- Assets --\u003e\n\n[set utilities]: https://github.com/kubikowski/set-utilities/wiki/assets/set-utilities.svg\n\n[difference visual]: https://github.com/kubikowski/set-utilities/wiki/assets/difference.svg\n[intersection visual]: https://github.com/kubikowski/set-utilities/wiki/assets/intersection.svg\n[union visual]: https://github.com/kubikowski/set-utilities/wiki/assets/union.svg\n[xor visual]: https://github.com/kubikowski/set-utilities/wiki/assets/xor.svg\n\n[equivalence visual]: https://github.com/kubikowski/set-utilities/wiki/assets/equivalence.svg\n[disjoint visual]: https://github.com/kubikowski/set-utilities/wiki/assets/disjoint.svg\n[pairwise disjoint visual]: https://github.com/kubikowski/set-utilities/wiki/assets/pairwise-disjoint.svg\n[subset visual]: https://github.com/kubikowski/set-utilities/wiki/assets/subset.svg\n[proper subset visual]: https://github.com/kubikowski/set-utilities/wiki/assets/proper-subset.svg\n[superset visual]: https://github.com/kubikowski/set-utilities/wiki/assets/superset.svg\n[proper superset visual]: https://github.com/kubikowski/set-utilities/wiki/assets/proper-superset.svg\n\n[sort visual]: https://github.com/kubikowski/set-utilities/wiki/assets/sort.svg\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubikowski%2Fset-utilities","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fkubikowski%2Fset-utilities","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fkubikowski%2Fset-utilities/lists"}