unist-util-generated is a utility within the unified ecosystem designed to determine if a unist node is 'generated.' A generated node is one that did not originate from the source text of the document but was rather programmatically created or modified, lacking explicit positional information. This is particularly useful for tools like linters, which might want to skip generated content to avoid reporting false positives to human authors. The package is currently stable at version 3.0.0 and adheres to a semantic versioning release cadence, with major versions often coinciding with shifts in Node.js compatibility or module system adoption. Its primary differentiator is its focused role in identifying synthetic content within unist trees, complementing other utilities like unist-util-position for retrieving positional data and unist-util-stringify-position for displaying it.
npm install unist-util-generatedVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to use `unist-util-generated` to check if various unist nodes are considered 'generated.' It illustrates that nodes lacking any `position` property, or those with empty `start` and `end` position objects, are flagged as generated, while nodes with valid line/column data are not.
Ensure your project is running on Node.js 16 or newer. Update your Node.js environment if necessary.
Migrate your codebase to use ES Modules (ESM) with `import` statements. For example, `import { generated } from 'unist-util-generated'`.Always import symbols directly from the main package entry point, e.g., `import { generated } from 'unist-util-generated'`. Avoid referencing internal file paths.Ensure the input `node` conforms to the unist `Node` interface, particularly if you expect a specific `generated` outcome based on its positional data. Nodes without a `position` property are considered generated.
Change `const { generated } = require('unist-util-generated')` to `import { generated } from 'unist-util-generated'`.Change `import generated from 'unist-util-generated'` to `import { generated } from 'unist-util-generated'`.Verify that your module system is correctly configured for ESM and that you are using the named import syntax: `import { generated } from 'unist-util-generated'`.No dependency data recorded yet.