{"id":25428791,"url":"https://github.com/forcir/subsequences","last_synced_at":"2025-05-14T08:35:08.393Z","repository":{"id":180592011,"uuid":"665367716","full_name":"forcir/subsequences","owner":"forcir","description":"Easily generate subsequences from a provided map, array, or string input.","archived":false,"fork":false,"pushed_at":"2023-08-14T03:22:31.000Z","size":91,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-04-18T03:34:30.801Z","etag":null,"topics":["subarray","subarrays","subsequence","subsequences","subset","subsets"],"latest_commit_sha":null,"homepage":"https://npmjs.com/subsequences","language":"TypeScript","has_issues":false,"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/forcir.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":".github/CODEOWNERS","security":null,"support":null,"governance":null}},"created_at":"2023-07-12T03:56:45.000Z","updated_at":"2023-08-13T07:24:36.000Z","dependencies_parsed_at":"2023-08-11T04:57:54.871Z","dependency_job_id":"84bae4f9-0f81-4e87-924f-9fd29551fb79","html_url":"https://github.com/forcir/subsequences","commit_stats":null,"previous_names":["pqt/subsequences","forcir/subsequences"],"tags_count":0,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcir%2Fsubsequences","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcir%2Fsubsequences/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcir%2Fsubsequences/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/forcir%2Fsubsequences/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/forcir","download_url":"https://codeload.github.com/forcir/subsequences/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":254104663,"owners_count":22015519,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","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":["subarray","subarrays","subsequence","subsequences","subset","subsets"],"created_at":"2025-02-17T01:48:02.629Z","updated_at":"2025-05-14T08:35:08.387Z","avatar_url":"https://github.com/forcir.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\u003c/p\u003e\n\u003cdiv align=\"center\"\u003e\n    \u003cpicture\u003e\n        \u003csource media=\"(prefers-color-scheme: dark)\" srcset=\"https://cdn.forcir.com/oss/forcir-subsequences/assets/images/logos/dark.png\" height=\"64\"\u003e\n        \u003cimg alt=\"Forcir Subsequences\" src=\"https://cdn.forcir.com/oss/forcir-subsequences/assets/images/logos/light.png\" height=\"64\"\u003e\n    \u003c/picture\u003e\n\u003c/div\u003e\n\u003cp align=\"center\"\u003e\u003cstrong\u003eEasily generate subsequences from a provided map, array, or string input.\u003c/strong\u003e\u003c/p\u003e\n\u003cp align=\"center\"\u003e\u003c/p\u003e\n\n\u003e A subsequence is a sequence that can be derived from another sequence by removing zero or more elements, without changing the order of the remaining elements.\n\n## Install\n\n```bash\npnpm add subsequences\n```\n\n```bash\nyarn add subsequences\n```\n\n```bash\nnpm install subsequences\n```\n\n## Basic Usage\n\n```ts\nimport { Subsequence } from \"subsequences\";\n```\n\n### Generate subsequence from Array\n\n```ts\nconst subsequences = Subsequence.fromArray([\"1\", \"2\", \"3\", \"4\"]);\n\nconsole.log({ subsequences });\n```\n\n\u003cdetails\u003e\u003csummary\u003eOutput\u003c/summary\u003e\n\n```json\n{\n    \"subsequences\": [\n        [\"1\", \"2\", \"3\", \"4\"],\n        [\"1\", \"2\", \"3\"],\n        [\"1\", \"2\", \"4\"],\n        [\"1\", \"2\"],\n        [\"1\", \"3\", \"4\"],\n        [\"1\", \"3\"],\n        [\"1\", \"4\"],\n        [\"1\"],\n        [\"2\", \"3\", \"4\"],\n        [\"2\", \"3\"],\n        [\"2\", \"4\"],\n        [\"2\"],\n        [\"3\", \"4\"],\n        [\"3\"],\n        [\"4\"]\n    ]\n}\n```\n\n\u003c/details\u003e\n\n### Generate subsequence from String\n\n```ts\nconst subsequences = Subsequence.fromString(\"1234\");\n\nconsole.log({ subsequences });\n```\n\n\u003cdetails\u003e\u003csummary\u003eOutput\u003c/summary\u003e\n\n```json\n{\n    \"subsequences\": [\n        [\"1\", \"2\", \"3\", \"4\"],\n        [\"1\", \"2\", \"3\"],\n        [\"1\", \"2\", \"4\"],\n        [\"1\", \"2\"],\n        [\"1\", \"3\", \"4\"],\n        [\"1\", \"3\"],\n        [\"1\", \"4\"],\n        [\"1\"],\n        [\"2\", \"3\", \"4\"],\n        [\"2\", \"3\"],\n        [\"2\", \"4\"],\n        [\"2\"],\n        [\"3\", \"4\"],\n        [\"3\"],\n        [\"4\"]\n    ]\n}\n```\n\n\u003c/details\u003e\n\n## Advanced Usage\n\n### Instantiate with Map (Key/Value Pairs)\n\n```ts\nimport { Subsequence } from \"subsequences\";\n\nconst subsequences = new Subsequence([\n    [\"first\", \"1\"],\n    [\"second\", \"2\"],\n    [\"third\", \"3\"],\n    [\"fourth\", \"4\"],\n]);\n\nconsole.log(subsequences.entrySubsequences);\nconsole.log(subsequences.i18nSubsequences);\nconsole.log(subsequences.keySubsequences);\nconsole.log(subsequences.valueSubsequences);\n```\n\n\u003cdetails\u003e\u003csummary\u003eentrySubsequences output\u003c/summary\u003e\n\n```json\n[\n    [\"first_1\", \"second_2\", \"third_3\", \"fourth_4\"],\n    [\"first_1\", \"second_2\", \"third_3\"],\n    [\"first_1\", \"second_2\", \"fourth_4\"],\n    [\"first_1\", \"second_2\"],\n    [\"first_1\", \"third_3\", \"fourth_4\"],\n    [\"first_1\", \"third_3\"],\n    [\"first_1\", \"fourth_4\"],\n    [\"first_1\"],\n    [\"second_2\", \"third_3\", \"fourth_4\"],\n    [\"second_2\", \"third_3\"],\n    [\"second_2\", \"fourth_4\"],\n    [\"second_2\"],\n    [\"third_3\", \"fourth_4\"],\n    [\"third_3\"],\n    [\"fourth_4\"]\n]\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003ei18nSubsequences output\u003c/summary\u003e\n\n```json\n[\n    {\n        \"key\": \"first1_second2_third3_fourth4\",\n        \"values\": { \"first\": \"1\", \"second\": \"2\", \"third\": \"3\", \"fourth\": \"4\" }\n    },\n    {\n        \"key\": \"first1_second2_third3\",\n        \"values\": { \"first\": \"1\", \"second\": \"2\", \"third\": \"3\" }\n    },\n    {\n        \"key\": \"first1_second2_fourth4\",\n        \"values\": { \"first\": \"1\", \"second\": \"2\", \"fourth\": \"4\" }\n    },\n    { \"key\": \"first1_second2\", \"values\": { \"first\": \"1\", \"second\": \"2\" } },\n    {\n        \"key\": \"first1_third3_fourth4\",\n        \"values\": { \"first\": \"1\", \"third\": \"3\", \"fourth\": \"4\" }\n    },\n    { \"key\": \"first1_third3\", \"values\": { \"first\": \"1\", \"third\": \"3\" } },\n    { \"key\": \"first1_fourth4\", \"values\": { \"first\": \"1\", \"fourth\": \"4\" } },\n    { \"key\": \"first1\", \"values\": { \"first\": \"1\" } },\n    {\n        \"key\": \"second2_third3_fourth4\",\n        \"values\": { \"second\": \"2\", \"third\": \"3\", \"fourth\": \"4\" }\n    },\n    { \"key\": \"second2_third3\", \"values\": { \"second\": \"2\", \"third\": \"3\" } },\n    { \"key\": \"second2_fourth4\", \"values\": { \"second\": \"2\", \"fourth\": \"4\" } },\n    { \"key\": \"second2\", \"values\": { \"second\": \"2\" } },\n    { \"key\": \"third3_fourth4\", \"values\": { \"third\": \"3\", \"fourth\": \"4\" } },\n    { \"key\": \"third3\", \"values\": { \"third\": \"3\" } },\n    { \"key\": \"fourth4\", \"values\": { \"fourth\": \"4\" } }\n]\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003ekeySubsequences output\u003c/summary\u003e\n\n```json\n[\n    [\"first\", \"second\", \"third\", \"fourth\"],\n    [\"first\", \"second\", \"third\"],\n    [\"first\", \"second\", \"fourth\"],\n    [\"first\", \"second\"],\n    [\"first\", \"third\", \"fourth\"],\n    [\"first\", \"third\"],\n    [\"first\", \"fourth\"],\n    [\"first\"],\n    [\"second\", \"third\", \"fourth\"],\n    [\"second\", \"third\"],\n    [\"second\", \"fourth\"],\n    [\"second\"],\n    [\"third\", \"fourth\"],\n    [\"third\"],\n    [\"fourth\"]\n]\n```\n\n\u003c/details\u003e\n\n\u003cdetails\u003e\u003csummary\u003evalueSubsequences output\u003c/summary\u003e\n\n```json\n[\n    [\"1\", \"2\", \"3\", \"4\"],\n    [\"1\", \"2\", \"3\"],\n    [\"1\", \"2\", \"4\"],\n    [\"1\", \"2\"],\n    [\"1\", \"3\", \"4\"],\n    [\"1\", \"3\"],\n    [\"1\", \"4\"],\n    [\"1\"],\n    [\"2\", \"3\", \"4\"],\n    [\"2\", \"3\"],\n    [\"2\", \"4\"],\n    [\"2\"],\n    [\"3\", \"4\"],\n    [\"3\"],\n    [\"4\"]\n]\n```\n\n\u003c/details\u003e\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforcir%2Fsubsequences","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fforcir%2Fsubsequences","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fforcir%2Fsubsequences/lists"}