{"id":51866769,"url":"https://github.com/flex-development/mark-util-chunked","last_synced_at":"2026-07-24T17:30:23.873Z","repository":{"id":368945597,"uuid":"1287615146","full_name":"flex-development/mark-util-chunked","owner":"flex-development","description":"mark utility to splice and push into giant arrays","archived":false,"fork":false,"pushed_at":"2026-07-15T02:28:17.000Z","size":2640,"stargazers_count":1,"open_issues_count":2,"forks_count":0,"subscribers_count":0,"default_branch":"main","last_synced_at":"2026-07-19T10:19:34.687Z","etag":null,"topics":["chunk","push","splice"],"latest_commit_sha":null,"homepage":"https://github.com/flex-development/mark-util-chunked","language":"TypeScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"bsd-3-clause","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/flex-development.png","metadata":{"files":{"readme":"README.md","changelog":"CHANGELOG.md","contributing":"CONTRIBUTING.md","funding":".github/funding.yml","license":"LICENSE.md","code_of_conduct":"CODE_OF_CONDUCT.md","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,"zenodo":null,"notice":null,"maintainers":null,"copyright":null,"agents":null,"dco":null,"cla":null},"funding":{"github":["flex-development"]}},"created_at":"2026-07-02T21:18:29.000Z","updated_at":"2026-07-15T02:28:21.000Z","dependencies_parsed_at":null,"dependency_job_id":null,"html_url":"https://github.com/flex-development/mark-util-chunked","commit_stats":null,"previous_names":["flex-development/mark-util-chunked"],"tags_count":0,"template":false,"template_full_name":null,"purl":"pkg:github/flex-development/mark-util-chunked","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fmark-util-chunked","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fmark-util-chunked/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fmark-util-chunked/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fmark-util-chunked/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/flex-development","download_url":"https://codeload.github.com/flex-development/mark-util-chunked/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/flex-development%2Fmark-util-chunked/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":286080680,"owners_count":35850516,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2026-07-20T02:08:10.276Z","status":"online","status_checked_at":"2026-07-24T02:00:07.870Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"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":["chunk","push","splice"],"created_at":"2026-07-24T17:30:22.979Z","updated_at":"2026-07-24T17:30:23.862Z","avatar_url":"https://github.com/flex-development.png","language":"TypeScript","funding_links":["https://github.com/sponsors/flex-development"],"categories":[],"sub_categories":[],"readme":"# mark-util-chunked\n\n[![github release](https://img.shields.io/github/v/release/flex-development/mark-util-chunked.svg?include_prereleases\\\u0026sort=semver)](https://github.com/flex-development/mark-util-chunked/releases/latest)\n[![npm](https://img.shields.io/npm/v/@flex-development/mark-util-chunked.svg)](https://npmjs.com/package/@flex-development/mark-util-chunked)\n[![npm downloads](https://img.shields.io/npm/dm/@flex-development/mark-util-chunked.svg)](https://www.npmcharts.com/compare/@flex-development/mark-util-chunked?interval=30)\n[![install size](https://packagephobia.now.sh/badge?p=@flex-development/mark-util-chunked)](https://packagephobia.now.sh/result?p=@flex-development/mark-util-chunked)\n[![minified bundle size](https://badgen.net/bundlephobia/min/@flex-development/mark-util-chunked?cache)](https://bundlephobia.com/package/@flex-development/mark-util-chunked)\n[![tree shaking suppport](https://badgen.net/bundlephobia/tree-shaking/@flex-development/mark-util-chunked)](https://bundlephobia.com/package/@flex-development/mark-util-chunked)\n[![codecov](https://codecov.io/gh/flex-development/mark-util-chunked/graph/badge.svg?token=qg27xOQM1a)](https://codecov.io/gh/flex-development/mark-util-chunked)\n[![module type: esm](https://img.shields.io/badge/module%20type-esm-brightgreen)](https://github.com/voxpelli/badges-cjs-esm)\n[![license](https://img.shields.io/github/license/flex-development/mark-util-chunked.svg)](LICENSE.md)\n[![conventional commits](https://img.shields.io/badge/-conventional%20commits-fe5196?logo=conventional-commits\\\u0026logoColor=ffffff)](https://conventionalcommits.org)\n[![typescript](https://img.shields.io/badge/-typescript-3178c6?logo=typescript\\\u0026logoColor=ffffff)](https://typescriptlang.org)\n[![vitest](https://img.shields.io/badge/-vitest-6e9f18?style=flat\\\u0026logo=vitest\\\u0026logoColor=ffffff)](https://vitest.dev)\n[![yarn](https://img.shields.io/badge/-yarn-2c8ebb?style=flat\\\u0026logo=yarn\\\u0026logoColor=ffffff)](https://yarnpkg.com)\n\n[`mark`][mark] utility to splice and push into giant arrays.\n\n## Contents\n\n- [What is this?](#what-is-this)\n- [When should I use this?](#when-should-i-use-this)\n- [Install](#install)\n- [Use](#use)\n- [API](#api)\n  - [`push\u003cT\u003e(list, items)`][api-push]\n  - [`splice\u003cT\u003e(list, start, remove[, items])`][api-splice]\n- [Types](#types)\n- [Project](#project)\n  - [Version](#version)\n  - [Contribute](#contribute)\n  - [Sponsor](#sponsor)\n- [Related](#related)\n\n## What is this?\n\nThis package exposes algorithms for splicing and pushing into giant arrays.\n\n## When should I use this?\n\nThis package is useful when creating your own your own [mark][] extensions and utilities.\n\n## Install\n\nThis package is [ESM only][esm].\n\nIn Node.js with [yarn][]:\n\n```sh\nyarn add @flex-development/mark-util-chunked\n```\n\n\u003cblockquote\u003e\n  \u003csmall\u003e\n    See \u003ca href='https://yarnpkg.com/protocol/git'\u003eGit - Protocols | Yarn\u003c/a\u003e\n    \u0026nbsp;for details regarding installing from Git.\n  \u003c/small\u003e\n\u003c/blockquote\u003e\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```ts\nimport { push, splice } from 'https://esm.sh/@flex-development/mark-util-chunked'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import { push, splice } from 'https://esm.sh/@flex-development/mark-util-chunked'\n\u003c/script\u003e\n```\n\n## Use\n\n```ts\nimport { push, splice } from '@flex-development/mark-util-chunked'\nimport { ev } from '@flex-development/mark-util-symbol'\nimport type { Token } from '@flex-development/mark'\n\n// ...\n\nconst token: Token = events[open][1]\n\n// ...\n\nnext = push(next, [[ev.enter, token, context], [ev.exit, token, context]])\n\n// ...\n\nsplice(events, open - 1, index - open + 3, next)\n\n// ...\n```\n\n## API\n\nThis package exports the identifiers [`push`][api-push] and [`splice`][api-splice].\\\nThere is no default export.\n\n### `push\u003cT\u003e(list, items)`\n\nAppend items to the end of `list`.\n\nItems are added in batches to prevent V8 from hanging.\\\nWhen `list` is empty, `items` is returned to prevent a potentially expensive operation.\n\n#### Type Parameters\n\n- `T` (`any`)\n  — The list item type\n\n#### Parameters\n\n- `list` (`T[]`)\n  — the list to operate on\n- `items` (`T[]`)\n  — the items to inject into `list`\n\n#### Returns\n\n(`T[]`) `items` when `list` is empty, `list` with appended items otherwise\n\n### `splice\u003cT\u003e(list, start, remove[, items])`\n\nLike [`Array#splice`][array-splice], but smarter.\n\nRemove items from `list` and, if necessary, insert new `items` in their place, returning the deleted elements.\n\n\u003e 👉 **Note**: `Array#splice` takes all items to be inserted as individual arguments which causes a stack overflow in V8\n\u003e when trying to insert a large number of items (i.e. 100k).\n\n#### Type Parameters\n\n- `T` (`any`)\n  — The list item type\n\n#### Parameters\n\n- `list` (`T[]`)\n  — the list to operate on\n- `start` ([`Numeric`][numeric] | `number`)\n  — the index in `list` to remove and/or insert items at (can be negative)\n- `remove` ([`Numeric`][numeric] | `number`)\n  — the number of items to remove\n- `items` ([`List\u003cT\u003e`][list] | `null` | `undefined`, optional)\n  — the items to inject into `list`\n\n#### Returns\n\n(`T[]`) The list of removed items\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports no additional types.\n\n## Project\n\n### Version\n\nmark-util-chunked adheres to [semver][].\n\n### Contribute\n\nSee [`CONTRIBUTING.md`](CONTRIBUTING.md).\n\nThis project has a [code of conduct](CODE_OF_CONDUCT.md).\nBy interacting with this repository, organization, or community you agree to abide by its terms.\n\n### Sponsor\n\nSmall primitives power larger systems.\nSupport long-term stability by sponsoring Flex Development.\n\n## Related\n\n- [`@flex-development/mark`][mark] — the specification\n- [`@flex-development/mark-compiler`][mark-compiler] — finite state machine event compiler\n- [`@flex-development/mark-parser`][mark-parser] — finite state machine parser\n\n[api-push]: #pushtlist-items\n\n[api-splice]: #splicetlist-start-remove-items\n\n[array-splice]: https://developer.mozilla.org/docs/Web/JavaScript/Reference/Global_Objects/Array/splice\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[list]: https://github.com/flex-development/mark/blob/main/src/core/types/list.mts\n\n[mark-compiler]: https://github.com/flex-development/mark-compiler\n\n[mark-parser]: https://github.com/flex-development/mark-tokenizer\n\n[mark]: https://github.com/flex-development/mark\n\n[numeric]: https://github.com/flex-development/mark/blob/main/src/core/types/numeric.mts\n\n[semver]: https://semver.org\n\n[typescript]: https://www.typescriptlang.org\n\n[yarn]: https://yarnpkg.com\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflex-development%2Fmark-util-chunked","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fflex-development%2Fmark-util-chunked","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fflex-development%2Fmark-util-chunked/lists"}