Project: syntax-tree/unist-util-generated

Package: unist-util-generated@2.0.0

  1. Dependents: 0
  2. unist utility to check if a node is generated
  1. util 145
  2. utility 141
  3. unist 132
  4. unist-util 25
  5. position 9
  6. location 4


Build Coverage Downloads Size Sponsors Backers Chat

unist utility to check if a node is generated.


What is this?

This utility can be used to check if a node is said to be generated.

When should I use this?

You can use this utility to check is generated. Generated nodes were not in the source of the original file, and thus not authored by a human. This info can then be used to not emit lint messages for generated content.

You might also find the utility unist-util-position useful to get clean positional info. To display positional info to users, use unist-util-stringify-position.


This package is ESM only. In Node.js (version 16+), install with npm:

npm install unist-util-generated

In Deno with esm.sh:

import {generated} from 'https://esm.sh/unist-util-generated@3'

In browsers with esm.sh:

<script type="module">
  import {generated} from 'https://esm.sh/unist-util-generated@3?bundle'


import {generated} from 'unist-util-generated'

generated({}) // => true

generated({position: {start: {}, end: {}}}) // => true

  position: {start: {line: 1, column: 1}, end: {line: 1, column: 2}}
}) // => false


This package exports the identifier generated. There is no default export.


Check if node is generated.


Whether node is generated (does not have positional info) (boolean).


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-generated@^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.


MIT © Titus Wormer