Gathering detailed insights and metrics for unist-util-remove-position
Gathering detailed insights and metrics for unist-util-remove-position
Gathering detailed insights and metrics for unist-util-remove-position
Gathering detailed insights and metrics for unist-util-remove-position
npm install unist-util-remove-position
Typescript
Module System
Node Version
NPM Version
JavaScript (90.59%)
TypeScript (9.41%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
12 Stars
103 Commits
2 Forks
8 Watchers
1 Branches
11 Contributors
Updated on Jul 22, 2024
Minified
Minified + Gzipped
Latest Version
5.0.0
Package Id
unist-util-remove-position@5.0.0
Unpacked Size
10.78 kB
Size
4.11 kB
File Count
7
NPM Version
9.7.2
Node Version
20.0.0
Published on
Jul 07, 2023
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
unist utility to remove positional info from a tree.
This is a small utility that helps you remove the position
field from nodes in
a unist tree.
Often, positional info is the whole reason, or an important reason, for using
ASTs.
Sometimes, especially when comparing trees, or when inserting one tree into
another, the positional info is at best useless and at worst harmful.
In those cases, you can use this utility to remove position
fields from a
tree.
You might find the utility unist-util-position
useful to instead get clean position info from a tree, or
unist-util-generated
useful to check whether a node is
considered to be generated (not in the original input file).
You might also enjoy
unist-util-stringify-position
when you want
to display positional info to users.
This package is ESM only. In Node.js (version 16+), install with npm:
1npm install unist-util-remove-position
In Deno with esm.sh
:
1import {removePosition} from 'https://esm.sh/unist-util-remove-position@5'
In browsers with esm.sh
:
1<script type="module"> 2 import {removePosition} from 'https://esm.sh/unist-util-remove-position@5?bundle' 3</script>
1import {fromMarkdown} from 'mdast-util-from-markdown' 2import {removePosition} from 'unist-util-remove-position' 3 4const tree = fromMarkdown('Some _emphasis_, **importance**, and `code`.') 5 6removePosition(tree, {force: true}) 7 8console.dir(tree, {depth: null})
Yields:
1{ 2 type: 'root', 3 children: [ 4 { 5 type: 'paragraph', 6 children: [ 7 {type: 'text', value: 'Some '}, 8 {type: 'emphasis', children: [{type: 'text', value: 'emphasis'}]}, 9 {type: 'text', value: ', '}, 10 {type: 'strong', children: [{type: 'text', value: 'importance'}]}, 11 {type: 'text', value: ', and '}, 12 {type: 'inlineCode', value: 'code'}, 13 {type: 'text', value: '.'} 14 ] 15 } 16 ] 17}
This package exports the identifier removePosition
.
There is no default export.
removePosition(node[, options])
Remove the position
field from a tree.
Nothing (undefined
).
Options
Configuration (TypeScript type).
force
(boolean
, default: false
)
— whether to use delete
to remove position
fields, the default is to
set them to undefined
This package is fully typed with TypeScript.
It exports the additional type Options
.
Projects maintained by the unified collective are compatible with maintained versions of Node.js.
When we cut a new major release, we drop support for unmaintained versions of
Node.
This means we try to keep the current release line,
unist-util-remove-position@^5
, compatible with Node.js 16.
See contributing.md
in syntax-tree/.github
for
ways to get started.
See support.md
for ways to get help.
This project has a code of conduct. By interacting with this repository, organization, or community you agree to abide by its terms.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
no SAST tool detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
project is not fuzzed
Details
Reason
Project has not signed or included provenance with any releases.
Details
Reason
branch protection not enabled on development/release branches
Details
Score
Last Scanned on 2025-06-23
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More