{"id":13339492,"url":"https://github.com/syntax-tree/unist-util-remove-position","last_synced_at":"2025-06-29T22:03:41.366Z","repository":{"id":57386393,"uuid":"51243316","full_name":"syntax-tree/unist-util-remove-position","owner":"syntax-tree","description":"utility to remove positions from a tree","archived":false,"fork":false,"pushed_at":"2023-07-07T10:24:50.000Z","size":121,"stargazers_count":12,"open_issues_count":0,"forks_count":2,"subscribers_count":8,"default_branch":"main","last_synced_at":"2025-06-01T08:53:02.734Z","etag":null,"topics":["clean","position","remove","strip","syntax-tree","unist","unist-util","util"],"latest_commit_sha":null,"homepage":"https://unifiedjs.com","language":"JavaScript","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/syntax-tree.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},"funding":{"github":"unifiedjs","open_collective":"unified"}},"created_at":"2016-02-07T10:14:02.000Z","updated_at":"2024-07-22T22:49:36.000Z","dependencies_parsed_at":"2024-06-18T15:30:51.484Z","dependency_job_id":"0343a8fe-dbd6-46f3-aac7-dc1f0b2c5f33","html_url":"https://github.com/syntax-tree/unist-util-remove-position","commit_stats":{"total_commits":102,"total_committers":4,"mean_commits":25.5,"dds":0.0490196078431373,"last_synced_commit":"6949dda1ff3cc24ab6b1b4fec3b6b3ed40f77bf4"},"previous_names":[],"tags_count":13,"template":false,"template_full_name":null,"purl":"pkg:github/syntax-tree/unist-util-remove-position","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Funist-util-remove-position","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Funist-util-remove-position/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Funist-util-remove-position/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Funist-util-remove-position/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/syntax-tree","download_url":"https://codeload.github.com/syntax-tree/unist-util-remove-position/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/syntax-tree%2Funist-util-remove-position/sbom","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":260047984,"owners_count":22951022,"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":["clean","position","remove","strip","syntax-tree","unist","unist-util","util"],"created_at":"2024-07-29T19:20:04.103Z","updated_at":"2025-06-29T22:03:41.340Z","avatar_url":"https://github.com/syntax-tree.png","language":"JavaScript","readme":"# unist-util-remove-position\n\n[![Build][build-badge]][build]\n[![Coverage][coverage-badge]][coverage]\n[![Downloads][downloads-badge]][downloads]\n[![Size][size-badge]][size]\n[![Sponsors][sponsors-badge]][collective]\n[![Backers][backers-badge]][collective]\n[![Chat][chat-badge]][chat]\n\n[unist][] utility to remove positional info from a tree.\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    *   [`removePosition(node[, options])`](#removepositionnode-options)\n    *   [`Options`](#options)\n*   [Types](#types)\n*   [Compatibility](#compatibility)\n*   [Contribute](#contribute)\n*   [License](#license)\n\n## What is this?\n\nThis is a small utility that helps you remove the `position` field from nodes in\na unist tree.\n\n## When should I use this?\n\nOften, positional info is the whole reason, or an important reason, for using\nASTs.\nSometimes, especially when comparing trees, or when inserting one tree into\nanother, the positional info is at best useless and at worst harmful.\nIn those cases, you can use this utility to remove `position` fields from a\ntree.\n\nYou might find the utility [`unist-util-position`][unist-util-position]\nuseful to instead get clean position info from a tree, or\n[`unist-util-generated`][unist-util-generated] useful to check whether a node is\nconsidered to be generated (not in the original input file).\n\nYou might also enjoy\n[`unist-util-stringify-position`][unist-util-stringify-position] when you want\nto display positional info to users.\n\n## Install\n\nThis package is [ESM only][esm].\nIn Node.js (version 16+), install with [npm][]:\n\n```sh\nnpm install unist-util-remove-position\n```\n\nIn Deno with [`esm.sh`][esmsh]:\n\n```js\nimport {removePosition} from 'https://esm.sh/unist-util-remove-position@5'\n```\n\nIn browsers with [`esm.sh`][esmsh]:\n\n```html\n\u003cscript type=\"module\"\u003e\n  import {removePosition} from 'https://esm.sh/unist-util-remove-position@5?bundle'\n\u003c/script\u003e\n```\n\n## Use\n\n```js\nimport {fromMarkdown} from 'mdast-util-from-markdown'\nimport {removePosition} from 'unist-util-remove-position'\n\nconst tree = fromMarkdown('Some _emphasis_, **importance**, and `code`.')\n\nremovePosition(tree, {force: true})\n\nconsole.dir(tree, {depth: null})\n```\n\nYields:\n\n```js\n{\n  type: 'root',\n  children: [\n    {\n      type: 'paragraph',\n      children: [\n        {type: 'text', value: 'Some '},\n        {type: 'emphasis', children: [{type: 'text', value: 'emphasis'}]},\n        {type: 'text', value: ', '},\n        {type: 'strong', children: [{type: 'text', value: 'importance'}]},\n        {type: 'text', value: ', and '},\n        {type: 'inlineCode', value: 'code'},\n        {type: 'text', value: '.'}\n      ]\n    }\n  ]\n}\n```\n\n## API\n\nThis package exports the identifier [`removePosition`][removeposition].\nThere is no default export.\n\n### `removePosition(node[, options])`\n\nRemove the `position` field from a tree.\n\n###### Parameters\n\n*   `node` ([`Node`][node])\n    — tree to clean\n*   `options` ([`Options`][options], optional)\n    — configuration\n\n###### Returns\n\nNothing (`undefined`).\n\n### `Options`\n\nConfiguration (TypeScript type).\n\n###### Fields\n\n*   `force` (`boolean`, default: `false`)\n    — whether to use `delete` to remove `position` fields, the default is to\n    set them to `undefined`\n\n## Types\n\nThis package is fully typed with [TypeScript][].\nIt exports the additional type [`Options`][options].\n\n## Compatibility\n\nProjects maintained by the unified collective are compatible with maintained\nversions of Node.js.\n\nWhen we cut a new major release, we drop support for unmaintained versions of\nNode.\nThis means we try to keep the current release line,\n`unist-util-remove-position@^5`, compatible with Node.js 16.\n\n## Contribute\n\nSee [`contributing.md`][contributing] in [`syntax-tree/.github`][health] for\nways to get started.\nSee [`support.md`][support] for ways to get help.\n\nThis project has a [code of conduct][coc].\nBy interacting with this repository, organization, or community you agree to\nabide by its terms.\n\n## License\n\n[MIT][license] © [Titus Wormer][author]\n\n\u003c!-- Definitions --\u003e\n\n[build-badge]: https://github.com/syntax-tree/unist-util-remove-position/workflows/main/badge.svg\n\n[build]: https://github.com/syntax-tree/unist-util-remove-position/actions\n\n[coverage-badge]: https://img.shields.io/codecov/c/github/syntax-tree/unist-util-remove-position.svg\n\n[coverage]: https://codecov.io/github/syntax-tree/unist-util-remove-position\n\n[downloads-badge]: https://img.shields.io/npm/dm/unist-util-remove-position.svg\n\n[downloads]: https://www.npmjs.com/package/unist-util-remove-position\n\n[size-badge]: https://img.shields.io/badge/dynamic/json?label=minzipped%20size\u0026query=$.size.compressedSize\u0026url=https://deno.bundlejs.com/?q=unist-util-remove-position\n\n[size]: https://bundlejs.com/?q=unist-util-remove-position\n\n[sponsors-badge]: https://opencollective.com/unified/sponsors/badge.svg\n\n[backers-badge]: https://opencollective.com/unified/backers/badge.svg\n\n[collective]: https://opencollective.com/unified\n\n[chat-badge]: https://img.shields.io/badge/chat-discussions-success.svg\n\n[chat]: https://github.com/syntax-tree/unist/discussions\n\n[npm]: https://docs.npmjs.com/cli/install\n\n[esm]: https://gist.github.com/sindresorhus/a39789f98801d908bbc7ff3ecc99d99c\n\n[esmsh]: https://esm.sh\n\n[typescript]: https://www.typescriptlang.org\n\n[license]: license\n\n[author]: https://wooorm.com\n\n[health]: https://github.com/syntax-tree/.github\n\n[contributing]: https://github.com/syntax-tree/.github/blob/main/contributing.md\n\n[support]: https://github.com/syntax-tree/.github/blob/main/support.md\n\n[coc]: https://github.com/syntax-tree/.github/blob/main/code-of-conduct.md\n\n[unist]: https://github.com/syntax-tree/unist\n\n[node]: https://github.com/syntax-tree/unist#node\n\n[unist-util-position]: https://github.com/syntax-tree/unist-util-position\n\n[unist-util-generated]: https://github.com/syntax-tree/unist-util-generated\n\n[unist-util-stringify-position]: https://github.com/syntax-tree/unist-util-stringify-position\n\n[removeposition]: #removepositionnode-options\n\n[options]: #options\n","funding_links":["https://github.com/sponsors/unifiedjs","https://opencollective.com/unified"],"categories":[],"sub_categories":[],"project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntax-tree%2Funist-util-remove-position","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fsyntax-tree%2Funist-util-remove-position","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fsyntax-tree%2Funist-util-remove-position/lists"}