Gathering detailed insights and metrics for unist-util-stringify-position
Gathering detailed insights and metrics for unist-util-stringify-position
Gathering detailed insights and metrics for unist-util-stringify-position
Gathering detailed insights and metrics for unist-util-stringify-position
unist-util-position
unist utility to get the position of a node
unist-util-remove-position
unist utility to remove positions from a tree
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 serialize a node, position, or point as a human readable location
npm install unist-util-stringify-position
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
6 Stars
101 Commits
2 Forks
9 Watching
1 Branches
12 Contributors
Updated on 01 Feb 2024
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
-2.4%
2,672,733
Compared to previous day
Last week
4.1%
14,217,956
Compared to previous week
Last month
14.8%
59,260,342
Compared to previous month
Last year
22.9%
619,699,368
Compared to previous year
1
unist utility to pretty print the positional info of a node.
This package is a utility that takes any unist (whether mdast, hast, etc) node, position, or point, and serializes its positional info.
This utility is useful to display where something occurred in the original document, in one standard way, for humans. For example, when throwing errors or warning messages about something.
This package is ESM only. In Node.js (version 16+), install with npm:
1npm install unist-util-stringify-position
In Deno with esm.sh
:
1import {stringifyPosition} from 'https://esm.sh/unist-util-stringify-position@4'
In browsers with esm.sh
:
1<script type="module"> 2 import {stringifyPosition} from 'https://esm.sh/unist-util-stringify-position@4?bundle' 3</script>
1import {stringifyPosition} from 'unist-util-stringify-position' 2 3stringifyPosition({line: 2, column: 3}) // => '2:3' (point) 4stringifyPosition({start: {line: 2}, end: {line: 3}}) // => '2:1-3:1' (position) 5stringifyPosition({ 6 type: 'text', 7 value: '!', 8 position: { 9 start: {line: 5, column: 11}, 10 end: {line: 5, column: 12} 11 } 12}) // => '5:11-5:12' (node)
This package exports the identifier stringifyPosition
.
There is no default export.
stringifyPosition(node|position|point)
Serialize the positional info of a point, position (start and end points), or node.
node
(Node
)
— node whose position
fields to serializeposition
(Position
)
— position whose start
and end
points to serializepoint
(Point
)
— point whose line
and column
fields to serializePretty printed positional info of a node (string
).
In the format of a range ls:cs-le:ce
(when given node
or position
) or a
point l:c
(when given point
), where l
stands for line, c
for column, s
for start
, and e
for end.
An empty string (''
) is returned if the given value is neither node
,
position
, nor point
.
This package is fully typed with TypeScript. It exports no additional types.
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-stringify-position@^4
, compatible with Node.js 16.
This project is safe.
unist-util-generated
— check if a node is generatedunist-util-position
— get positional info of nodesunist-util-remove-position
— remove positional info from treesunist-util-source
— get the source of a value (node or position) in a fileSee 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 dangerous workflow patterns detected
Reason
no binaries found in the repo
Reason
0 existing vulnerabilities detected
Reason
license file detected
Details
Reason
security policy file detected
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no SAST tool detected
Details
Reason
Found 0/30 approved changesets -- score normalized to 0
Reason
dependency not pinned by hash detected -- score normalized to 0
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
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