{"id":39113807,"url":"https://github.com/haydn/set-fns","last_synced_at":"2026-01-17T20:01:21.964Z","repository":{"id":55846937,"uuid":"192656844","full_name":"haydn/set-fns","owner":"haydn","description":"∅ A utility library for working with sets.","archived":false,"fork":false,"pushed_at":"2022-06-05T09:42:25.000Z","size":183,"stargazers_count":21,"open_issues_count":4,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-08-31T17:33:01.256Z","etag":null,"topics":["set-theory","sets"],"latest_commit_sha":null,"homepage":"","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/haydn.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null}},"created_at":"2019-06-19T04:13:24.000Z","updated_at":"2025-08-23T09:39:44.000Z","dependencies_parsed_at":"2022-08-15T07:50:38.156Z","dependency_job_id":null,"html_url":"https://github.com/haydn/set-fns","commit_stats":null,"previous_names":[],"tags_count":3,"template":false,"template_full_name":null,"purl":"pkg:github/haydn/set-fns","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haydn%2Fset-fns","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haydn%2Fset-fns/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haydn%2Fset-fns/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haydn%2Fset-fns/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/haydn","download_url":"https://codeload.github.com/haydn/set-fns/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/haydn%2Fset-fns/sbom","scorecard":{"id":458123,"data":{"date":"2025-08-11","repo":{"name":"github.com/haydn/set-fns","commit":"7197eab6e7afbbe0c529786bd3f47fa0a4697362"},"scorecard":{"version":"v5.2.1-40-gf6ed084d","commit":"f6ed084d17c9236477efd66e5b258b9d4cc7b389"},"score":1.7,"checks":[{"name":"Packaging","score":-1,"reason":"packaging workflow not detected","details":["Warn: no GitHub/GitLab publishing workflow detected."],"documentation":{"short":"Determines if the project is published as a package that others can easily download, install, easily update, and uninstall.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#packaging"}},{"name":"Maintained","score":0,"reason":"0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project is \"actively maintained\".","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#maintained"}},{"name":"Token-Permissions","score":-1,"reason":"No tokens found","details":null,"documentation":{"short":"Determines if the project's workflows follow the principle of least privilege.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#token-permissions"}},{"name":"Binary-Artifacts","score":10,"reason":"no binaries found in the repo","details":null,"documentation":{"short":"Determines if the project has generated executable (binary) artifacts in the source repository.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#binary-artifacts"}},{"name":"SAST","score":0,"reason":"no SAST tool detected","details":["Warn: no pull requests merged into dev branch"],"documentation":{"short":"Determines if the project uses static code analysis.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#sast"}},{"name":"Code-Review","score":0,"reason":"Found 0/11 approved changesets -- score normalized to 0","details":null,"documentation":{"short":"Determines if the project requires human code review before pull requests (aka merge requests) are merged.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#code-review"}},{"name":"Pinned-Dependencies","score":-1,"reason":"no dependencies found","details":null,"documentation":{"short":"Determines if the project has declared and pinned the dependencies of its build process.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#pinned-dependencies"}},{"name":"Dangerous-Workflow","score":-1,"reason":"no workflows found","details":null,"documentation":{"short":"Determines if the project's GitHub Action workflows avoid dangerous patterns.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#dangerous-workflow"}},{"name":"CII-Best-Practices","score":0,"reason":"no effort to earn an OpenSSF best practices badge detected","details":null,"documentation":{"short":"Determines if the project has an OpenSSF (formerly CII) Best Practices Badge.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#cii-best-practices"}},{"name":"Security-Policy","score":0,"reason":"security policy file not detected","details":["Warn: no security policy file detected","Warn: no security file to analyze","Warn: no security file to analyze","Warn: no security file to analyze"],"documentation":{"short":"Determines if the project has published a security policy.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#security-policy"}},{"name":"Fuzzing","score":0,"reason":"project is not fuzzed","details":["Warn: no fuzzer integrations found"],"documentation":{"short":"Determines if the project uses fuzzing.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#fuzzing"}},{"name":"License","score":10,"reason":"license file detected","details":["Info: project has a license file: LICENSE:0","Info: FSF or OSI recognized license: MIT License: LICENSE:0"],"documentation":{"short":"Determines if the project has defined a license.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#license"}},{"name":"Signed-Releases","score":-1,"reason":"no releases found","details":null,"documentation":{"short":"Determines if the project cryptographically signs release artifacts.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#signed-releases"}},{"name":"Branch-Protection","score":0,"reason":"branch protection not enabled on development/release branches","details":["Warn: branch protection not enabled for branch 'master'"],"documentation":{"short":"Determines if the default and release branches are protected with GitHub's branch protection settings.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#branch-protection"}},{"name":"Vulnerabilities","score":0,"reason":"22 existing vulnerabilities detected","details":["Warn: Project is vulnerable to: GHSA-93q8-gq69-wqmw","Warn: Project is vulnerable to: GHSA-v6h2-p8h4-qcjw","Warn: Project is vulnerable to: GHSA-3xgq-45jj-v275","Warn: Project is vulnerable to: GHSA-ff7x-qrg7-qggm","Warn: Project is vulnerable to: GHSA-pfrx-2q88-qq97","Warn: Project is vulnerable to: GHSA-43f8-2h32-f4cj","Warn: Project is vulnerable to: GHSA-rc47-6667-2j5j","Warn: Project is vulnerable to: GHSA-qqgx-2p2h-9c37","Warn: Project is vulnerable to: GHSA-jf85-cpcp-j695","Warn: Project is vulnerable to: GHSA-p6mc-m468-83gw","Warn: Project is vulnerable to: GHSA-29mw-wpgm-hmr9","Warn: Project is vulnerable to: GHSA-35jh-r3h4-6jhm","Warn: Project is vulnerable to: GHSA-f8q6-p94x-37v3","Warn: Project is vulnerable to: GHSA-vh95-rmgr-6w4m","Warn: Project is vulnerable to: GHSA-xvch-5gv4-984h","Warn: Project is vulnerable to: GHSA-px4h-xg32-q955","Warn: Project is vulnerable to: GHSA-hj48-42vr-x3v9","Warn: Project is vulnerable to: GHSA-c2qf-rxjj-qqgw","Warn: Project is vulnerable to: GHSA-52f5-9888-hmc6","Warn: Project is vulnerable to: GHSA-7p7h-4mm5-852v","Warn: Project is vulnerable to: GHSA-v4rh-8p82-6h5w","Warn: Project is vulnerable to: GHSA-p9pc-299p-vxgp"],"documentation":{"short":"Determines if the project has open, known unfixed vulnerabilities.","url":"https://github.com/ossf/scorecard/blob/f6ed084d17c9236477efd66e5b258b9d4cc7b389/docs/checks.md#vulnerabilities"}}]},"last_synced_at":"2025-08-19T10:17:59.496Z","repository_id":55846937,"created_at":"2025-08-19T10:17:59.496Z","updated_at":"2025-08-19T10:17:59.496Z"},"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":28517429,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-01-17T18:55:29.170Z","status":"ssl_error","status_checked_at":"2026-01-17T18:55:03.375Z","response_time":85,"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":["set-theory","sets"],"created_at":"2026-01-17T20:01:21.136Z","updated_at":"2026-01-17T20:01:21.955Z","avatar_url":"https://github.com/haydn.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cdiv align=\"center\"\u003e\n  \u003ch1\u003e\n    \u003cimg src=\"logo.png\" alt=\"set-fns\" width=\"160\" /\u003e\n  \u003c/h1\u003e\n  \u003cp\u003eA utility library for working with sets in JavaScript.\u003c/p\u003e\n  \u003cp\u003e\n    \u003cimg alt=\"npm bundle size\" src=\"https://img.shields.io/bundlephobia/min/set-fns.svg\"\u003e\n    \u003cimg alt=\"npm\" src=\"https://img.shields.io/npm/dw/set-fns.svg\"\u003e\n  \u003c/p\u003e\n\u003c/div\u003e\n\n## Features\n\n- Pure functions that support immutability.\n- Flow and TypeScript declarations included.\n- CommonJS, UMD and ESM modules provided.\n- Zero dependencies.\n\n## Installation\n\nYarn:\n\n```shell\nyarn add set-fns\n```\n\nNPM:\n\n```shell\nnpm install set-fns\n```\n\n## Usage\n\n```js\nimport { set, union, intersection, difference, subset } from \"set-fns\";\n\nconst alphabet = set(\"abcdefghijklmnopqrstuvwxyz\".split(\"\"));\n\nconst sentence = set(\"the quick brown fox jumped over the lazy dog!\".split(\"\"));\n\nconsole.log(\"All characters\", union(alphabet, sentence));\n\nconsole.log(\n  \"Characters from the alphabet used in the sentence\",\n  intersection(alphabet, sentence)\n);\n\nif (!subset(sentence, alphabet)) {\n  console.log(\n    \"Extra character(s) found in sentence!\",\n    difference(sentence, alphabet)\n  );\n}\n```\n\n## API\n\n### set\n\n```ts\ndeclare const set: \u003cT\u003e(x?: Iterable\u003cT\u003e) =\u003e Set\u003cT\u003e;\n```\n\nTakes an iterable and returns a set of all items in that iterable. If the iterable is already a set it is returned unchanged.\n\n```js\nconst a = set([1, 2, 3]); // Set { 1, 2, 3 }\nconst b = set(a); // Set { 1, 2, 3 }\nconst c = set([1, 2, 3]); // Set { 1, 2, 3 }\na === b; // true\na === c; // false\n```\n\n### and / intersection\n\n\u003cimg src=\"illustrations/and.png\" width=\"200\" /\u003e\n\n```ts\ndeclare const and: \u003cT\u003e(a: Iterable\u003cT\u003e, b: Iterable\u003cT\u003e) =\u003e Set\u003cT\u003e;\n```\n\nTakes two iterables and returns a set of all items that appear in both.\n\n```js\nconst a = [1, 2, 3, 4];\nconst b = [6, 5, 4, 3];\nand(a, b); // Set { 3, 4 }\nintersection(a, b); // Set { 3, 4 }\n```\n\n### or / union\n\n\u003cimg src=\"illustrations/or.png\" width=\"200\" /\u003e\n\n```ts\ndeclare const or: \u003cT\u003e(a: Iterable\u003cT\u003e, b: Iterable\u003cT\u003e) =\u003e Set\u003cT\u003e;\n```\n\nTakes two iterables and returns a set of all items that appear in either.\n\n```js\nconst a = [1, 2, 3, 4];\nconst b = [6, 5, 4, 3];\nor(a, b); // Set { 1, 2, 3, 4, 5, 6 }\nunion(a, b); // Set { 1, 2, 3, 4, 5, 6 }\n```\n\n### not / subtract / difference\n\n\u003cimg src=\"illustrations/not.png\" width=\"200\" /\u003e\n\n```ts\ndeclare const not: \u003cT\u003e(a: Iterable\u003cT\u003e, b: Iterable\u003cT\u003e) =\u003e Set\u003cT\u003e;\n```\n\nTakes two iterables and returns a set of all items that appear the first, but not the second.\n\n```js\nconst a = [1, 2, 3, 4];\nconst b = [6, 5, 4, 3];\nnot(a, b); // Set { 1, 2 }\nsubtract(a, b); // Set { 1, 2 }\ndifference(a, b); // Set { 1, 2 }\n```\n\n### xor\n\n\u003cimg src=\"illustrations/xor.png\" width=\"200\" /\u003e\n\n```ts\ndeclare const xor: \u003cT\u003e(a: Iterable\u003cT\u003e, b: Iterable\u003cT\u003e) =\u003e Set\u003cT\u003e;\n```\n\nTakes two iterables and returns a set of all items that appear exclusively in the first or the second (do not appear in both iterables).\n\n```js\nconst a = [1, 2, 3, 4];\nconst b = [6, 5, 4, 3];\nxor(a, b); // Set { 1, 2, 5, 6 }\n```\n\n### equal\n\n```ts\ndeclare const equal: (a: Iterable\u003cany\u003e, b: Iterable\u003cany\u003e) =\u003e boolean;\n```\n\nTakes two iterables and returns true if both contain the exactly the same items.\n\n```js\nconst a = [1, 2, 3];\nconst b = [3, 2, 1];\nconst c = [3, 3, 2, 2, 1, 1];\nequal(a, b); // true\nequal(a, c); // true\n```\n\n### subset\n\n```ts\ndeclare const subset: (a: Iterable\u003cany\u003e, b: Iterable\u003cany\u003e) =\u003e boolean;\n```\n\nTakes two iterables and returns true if the first is a subset of the second.\n\n```js\nconst a = [1, 2];\nconst b = [1, 2, 3];\nconst c = [1, 2];\nsubset(a, b); // true\nsubset(a, c); // true\n```\n\n### strictSubset\n\n```ts\ndeclare const strictSubset: (a: Iterable\u003cany\u003e, b: Iterable\u003cany\u003e) =\u003e boolean;\n```\n\nTakes two iterables and returns true if the first is a strict subset of the second.\n\n```js\nconst a = [1, 2];\nconst b = [1, 2, 3];\nconst c = [1, 2];\nstrictSubset(a, b); // true\nstrictSubset(a, c); // false\n```\n\n### superset\n\n```ts\ndeclare const superset: (a: Iterable\u003cany\u003e, b: Iterable\u003cany\u003e) =\u003e boolean;\n```\n\nTakes two iterables and returns true if the first is a superset of the second.\n\n```js\nconst a = [1, 2, 3];\nconst b = [1, 2];\nconst c = [1, 2, 3];\nsuperset(a, b); // true\nsuperset(a, c); // true\n```\n\n### strictSuperset\n\n```ts\ndeclare const strictSuperset: (a: Iterable\u003cany\u003e, b: Iterable\u003cany\u003e) =\u003e boolean;\n```\n\nTakes two iterables and returns true if the first is a strict superset of the second.\n\n```js\nconst a = [1, 2, 3];\nconst b = [1, 2];\nconst c = [1, 2, 3];\nstrictSuperset(a, b); // true\nstrictSuperset(a, c); // false\n```\n\n### intersects\n\n```ts\ndeclare const intersects: (a: Iterable\u003cany\u003e, b: Iterable\u003cany\u003e) =\u003e boolean;\n```\n\nTakes two iterables and returns true if the two intersect.\n\n```js\nconst a = [1, 2];\nconst b = [2, 3];\nconst c = [3, 4];\nintersects(a, b); // true\nintersects(a, c); // false\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaydn%2Fset-fns","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fhaydn%2Fset-fns","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fhaydn%2Fset-fns/lists"}