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
unist-util-stringify-position
unist utility to serialize a node, position, or point as a human readable location
unist-util-position
unist utility to get the position of a node
unist-util-position-from-estree
unist utility to get a position from an estree node
unist-util-generated
unist utility to check if a node is generated
utility to remove positions from a tree
npm install unist-util-remove-position
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
12 Stars
103 Commits
2 Forks
9 Watching
1 Branches
11 Contributors
Updated on 22 Jul 2024
JavaScript (90.59%)
TypeScript (9.41%)
Cumulative downloads
Total Downloads
Last day
-0.9%
941,263
Compared to previous day
Last week
4.2%
5,028,618
Compared to previous week
Last month
10.2%
20,960,457
Compared to previous month
Last year
-13.1%
247,968,130
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
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
dependency not pinned by hash detected -- score normalized to 0
Details
Reason
no SAST tool detected
Details
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 2024-11-18
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