{"id":18698433,"url":"https://github.com/plurid/plurid-data-structures-typescript","last_synced_at":"2026-04-30T13:32:32.907Z","repository":{"id":57137356,"uuid":"233295685","full_name":"plurid/plurid-data-structures-typescript","owner":"plurid","description":"Utility Data Structures Implemented in TypeScript","archived":false,"fork":false,"pushed_at":"2023-04-26T13:40:58.000Z","size":391,"stargazers_count":1,"open_issues_count":0,"forks_count":0,"subscribers_count":2,"default_branch":"master","last_synced_at":"2025-09-28T15:55:58.568Z","etag":null,"topics":["data-structures","typescript"],"latest_commit_sha":null,"homepage":"","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"other","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/plurid.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,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2020-01-11T20:52:36.000Z","updated_at":"2022-12-14T23:10:48.000Z","dependencies_parsed_at":"2024-11-07T11:42:55.944Z","dependency_job_id":null,"html_url":"https://github.com/plurid/plurid-data-structures-typescript","commit_stats":{"total_commits":102,"total_committers":1,"mean_commits":102.0,"dds":0.0,"last_synced_commit":"935ed4ce7bde8724e1b00564f1953b192301a3af"},"previous_names":[],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/plurid/plurid-data-structures-typescript","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plurid%2Fplurid-data-structures-typescript","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plurid%2Fplurid-data-structures-typescript/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plurid%2Fplurid-data-structures-typescript/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plurid%2Fplurid-data-structures-typescript/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/plurid","download_url":"https://codeload.github.com/plurid/plurid-data-structures-typescript/tar.gz/refs/heads/master","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/plurid%2Fplurid-data-structures-typescript/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":32466333,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-04-30T13:12:12.517Z","status":"ssl_error","status_checked_at":"2026-04-30T13:12:06.837Z","response_time":57,"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":["data-structures","typescript"],"created_at":"2024-11-07T11:28:18.508Z","updated_at":"2026-04-30T13:32:32.889Z","avatar_url":"https://github.com/plurid.png","language":"TypeScript","funding_links":[],"categories":[],"sub_categories":[],"readme":"\u003cp align=\"center\"\u003e\n    \u003cimg src=\"https://raw.githubusercontent.com/plurid/plurid-data-structures-typescript/master/about/identity/plurid-logo.png\" height=\"250px\"\u003e\n    \u003cbr /\u003e\n    \u003cbr /\u003e\n    \u003ca target=\"_blank\" href=\"https://www.npmjs.com/package/@plurid/plurid-data-structures\"\u003e\n        \u003cimg src=\"https://img.shields.io/npm/v/@plurid/plurid-data-structures.svg?logo=npm\u0026colorB=1380C3\u0026style=for-the-badge\" alt=\"Version\"\u003e\n    \u003c/a\u003e\n    \u003ca target=\"_blank\" href=\"https://github.com/plurid/plurid-data-structures-typescript/blob/master/LICENSE\"\u003e\n        \u003cimg src=\"https://img.shields.io/badge/license-DEL-blue.svg?colorB=1380C3\u0026style=for-the-badge\" alt=\"License: DEL\"\u003e\n    \u003c/a\u003e\n\u003c/p\u003e\n\n\n\n\u003ch1 align=\"center\"\u003e\n    plurid' data structures for typescript\n\u003c/h1\u003e\n\n\n\u003ch3 align=\"center\"\u003e\n    Utility data structures to be used in TypesScript projects.\n\u003c/h3\u003e\n\n\n\n\u003cbr /\u003e\n\n\n\n### Contents\n\n+ [About](#about)\n+ [Packages](#packages)\n+ [Codeophon](#codeophon)\n\n\n\n## About\n\nThe package contains the following data structures\n\n+ [Batcher](#batcher)\n+ [Cacher](#cacher)\n+ [CacherManager](#cachergetter)\n+ [Stepper](#stepper)\n+ [DeposedString](#deposedstring)\n+ [LinkedList](#linkedlist)\n+ [PieceTable](#piecetable)\n\n\n### Batcher\n\nRuns a batched `action` of `size` at certain `time` after `push`ing into the `Batcher`.\n\n``` typescript\nimport {\n    Batcher,\n} from '@plurid/plurid-data-structures';\n\n\nconst batcher = new Batcher\u003cstring\u003e(\n    (batch) =\u003e {\n        console.log(batch);\n    },\n    {\n        size: 2,\n    },\n);\n\nbatcher.push('one');\nbatcher.push('two');\nbatcher.push('three');\n```\n\n\n\n### Cacher\n\nCaches by `id` a generic `T` data structure.\n\n``` typescript\nimport {\n    Cacher,\n} from '@plurid/plurid-data-structures';\n\n\nconst cache = new Cacher\u003cstring\u003e();\n\nconst a = cache.get('one') // undefined\ncache.set('one', 'two'); // true\nconst b = cache.get('one') // 'two'\n\ncache.unset('one') // true\ncache.reset(); // true\n```\n\n\n\n### CacherManager\n\nA `Cacher` which runs a `cache get` after a cache miss and a `cache unset` at cleanup.\n\n``` typescript\nimport {\n    CacherManager,\n} from '@plurid/plurid-data-structures';\n\n\nconst cacherManager = new CacherManager\u003cstring, any\u003e(\n    // An array of cacher calls executed in order until one or none fills the cache request.\n    [\n        (\n            index: string,\n            context?: any,\n        ) =\u003e {\n            // return based on index value\n            if (Math.random() \u003c 0.5) {\n                return 'one';\n            }\n\n            return;\n        },\n        async (\n            index: string,\n            context?: any,\n        ) =\u003e {\n            // return based on index value\n            // runs asynchronously\n            return 'two';\n        },\n    ],\n    [\n        (\n            index: string,\n            cache: string,\n            context?: any,\n        ) =\u003e {\n            // unset cleanup\n        },\n    ],\n    {}, // `Cacher` options\n);\n\n\ncacherManager.get('one'); // 0.5 chance of getting `'one'` or `Promise\u003c'two'\u003e`.\ncacherManager.getAsynchronous('one'); // 0.5 chance of getting `'one'` or `'two'`.\ncacherManager.getAsynchronous('one', { context: 'data' });\n```\n\n\n\n### Stepper\n\nThe `Stepper` debounces the incrementation and decrementation of numerical values.\n\n``` typescript\nconst id = 'one';\nconst stepper = new Stepper();\n\nstepper.define(\n    id,\n    async (value) =\u003e {\n        // use value asynchronously\n        // the value will be 2\n    },\n); // the value is 0\n\nstepper.step(\n    id,\n    1,\n); // the value is 0 + 1 = 1\nstepper.step(\n    id,\n    -1,\n); // the value is 1 - 1 = 0\nstepper.step(\n    id,\n    2,\n); // the value is 0 + 2 = 2\n```\n\n\n\n### DeposedString\n\nComputes differences between strings after each `push` and stores them as internal `stages`. At `get` the string is recomposed starting from the initial string following through all the steps of the stages.\n\nThe name, `deposed string`, stands for `differentially composable string`.\n\nThe `DeposedString` is intended for efficient persistent storage of historic changes to a text (a simple note, a comment, or even a long-form text).\n\n``` typescript\nimport {\n    DeposedString,\n} from '@plurid/plurid-data-structures';\n\n\nconst deposedString = new DeposedString('');\n\ndeposedString.push('a1b2c3');\ndeposedString.push('a1c3');\ndeposedString.push('13d4');\n\nconst a = deposedString.get(0); // 'a1b2c3'\nconst b = deposedString.get(1); // 'a1c3'\nconst c = deposedString.get(2); // '13d4'\nconsole.log({ a, b, c });\n\nconst unload = deposedString.unload(); // extract the stages\nconsole.log('unload', JSON.stringify(unload, null, 4));\n// unload -\u003e {\n//     initial: '',\n//     stages: [\n//         [\n//             [ '+', 0, 'a1b2c3' ],\n//         ],\n//         [\n//             [ '-', 2, 2 ],\n//         ],\n//         [\n//             [ '-', 0, 1 ],\n//             [ '-', 1, 1 ],\n//             [ '+', 2, 'd4' ],\n//         ],\n//     ],\n// }\n\nconst freshDeposedString = new DeposedString('');\nfreshDeposedString.load(unload.stages); // load the stages into a new DeposedString\n\nconst freshC = freshDeposedString.get(2); // '13d4'\nconsole.log({ freshC });\n```\n\n\n### LinkedList\n\n`LinkedList` implementation.\n\n``` typescript\nimport {\n    LinkedList,\n} from '@plurid/plurid-data-structures';\n\n\nconst linkedList = new LinkedList();\nlinkedList.add(10);\nlinkedList.add(20);\n```\n\n\n###  PieceTable\n\n`PieceTable` implementation.\n\n``` typescript\nimport {\n    PieceTable,\n} from '@plurid/plurid-data-structures';\n\nconst pieceTable = new PieceTable('original string');\npieceTable.insert(' text', 15); // insert at index 15, the end\npieceTable.delete(8, 1); // delete at index 8, the space between 'original' and 'string'\nconst text = pieceTable.stringAt(0, 19); // 'originalstring text'\n```\n\n\n\n## Packages\n\n\u003ca target=\"_blank\" href=\"https://www.npmjs.com/package/@plurid/plurid-data-structures\"\u003e\n    \u003cimg src=\"https://img.shields.io/npm/v/@plurid/plurid-data-structures.svg?logo=npm\u0026colorB=1380C3\u0026style=for-the-badge\" alt=\"Version\"\u003e\n\u003c/a\u003e\n\n[@plurid/plurid-data-structures][plurid-data-structures]\n\n[plurid-data-structures]: https://github.com/plurid/plurid-data-structures-typescript\n\n\n\n## [Codeophon](https://github.com/ly3xqhl8g9/codeophon)\n\n+ licensing: [delicense](https://github.com/ly3xqhl8g9/delicense)\n+ versioning: [αver](https://github.com/ly3xqhl8g9/alpha-versioning)\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplurid%2Fplurid-data-structures-typescript","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fplurid%2Fplurid-data-structures-typescript","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fplurid%2Fplurid-data-structures-typescript/lists"}