Gathering detailed insights and metrics for unist-util-position-from-estree
Gathering detailed insights and metrics for unist-util-position-from-estree
Gathering detailed insights and metrics for unist-util-position-from-estree
Gathering detailed insights and metrics for unist-util-position-from-estree
unist-util-stringify-position
unist utility to serialize a node, position, or point as a human readable location
unist-util-remove-position
unist utility to remove positions from a tree
unist-util-position
unist utility to get the position of a node
estree-util-visit
esast (and estree) utility to visit nodes
unist utility to get a position from an estree node
npm install unist-util-position-from-estree
Module System
Min. Node Version
Typescript Support
Node Version
NPM Version
40 Commits
8 Watching
1 Branches
10 Contributors
Updated on 04 Mar 2022
JavaScript (100%)
Cumulative downloads
Total Downloads
Last day
1.1%
341,134
Compared to previous day
Last week
6.1%
1,820,617
Compared to previous week
Last month
13.3%
7,551,813
Compared to previous month
Last year
84.4%
70,037,130
Compared to previous year
1
unist utility to get a position from an estree node.
This package is a tiny utility that can create a proper unist position from an estree node
You can use this package when you want to use other unist utilities with estree nodes.
This package is ESM only. In Node.js (version 16+), install with npm:
1npm install unist-util-position-from-estree
In Deno with esm.sh
:
1import {positionFromEstree} from 'https://esm.sh/unist-util-position-from-estree@2'
In browsers with esm.sh
:
1<script type="module"> 2 import {positionFromEstree} from 'https://esm.sh/unist-util-position-from-estree@2?bundle' 3</script>
1import {parse} from 'acorn' 2import {positionFromEstree} from 'unist-util-position-from-estree' 3 4// Make acorn support line/column. 5const node = parse('function x() { console.log(1) }', { 6 ecmaVersion: 2020, 7 locations: true 8}) 9 10console.log(positionFromEstree(node)) // `Program` 11console.log(positionFromEstree(node.body[0].id)) // `x` 12console.log(positionFromEstree(node.body[0].body.body[0].expression)) // Call
Yields:
1{ 2 start: {line: 1, column: 1, offset: 0}, 3 end: {line: 1, column: 32, offset: 31} 4} 5{ 6 start: {line: 1, column: 10, offset: 9}, 7 end: {line: 1, column: 11, offset: 10} 8} 9{ 10 start: {line: 1, column: 16, offset: 15}, 11 end: {line: 1, column: 30, offset: 29} 12}
This package exports the identifier positionFromEstree
.
There is no default export.
positionFromEstree(node)
Turn an estree node
into a unist position
.
node
(Node
)
— estree nodeunist position, if valid (Position
or undefined
).
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-position-from-estree@^2
, 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
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
detected GitHub workflow tokens with excessive permissions
Details
Reason
Found 1/30 approved changesets -- score normalized to 0
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
Reason
SAST tool is not run on all commits -- score normalized to 0
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