nlcst-to-string is a utility designed to serialize NLCST (Natural Language Concrete Syntax Tree) nodes into their plain-text string representation. It is part of the unified ecosystem, focusing specifically on text content extraction from linguistic ASTs. The current stable version is 4.0.0. Releases follow the unified collective's compatibility policy, typically dropping support for unmaintained Node.js versions with new major releases (e.g., v4 requires Node.js 16+). Key differentiators include its tight integration with the NLCST specification, its minimal API (a single `toString` function), and its robust handling of various NLCST node types by prioritizing plain-text fields or recursively serializing children. This package is an ESM-only module since version 3.0.0 and ships with full TypeScript type definitions.
npm install nlcst-to-stringVerified import paths — ran on the pinned version, not inferred.
This quickstart demonstrates how to import and use the `toString` function to convert an NLCST node or a list of nodes into a plain-text string, showing its handling of different node types.
Upgrade your Node.js environment to version 16 or newer. If unable to upgrade, consider staying on `nlcst-to-string@3` (which requires Node.js 12+).
Remove the `separator` option from your `toString` calls. The utility now solely focuses on extracting concatenated text content.
Refactor your imports to use ES module syntax (e.g., `import { toString } from 'nlcst-to-string'`). Ensure your project is configured for ESM, potentially by setting `"type": "module"` in `package.json` or using `.mjs` extensions.Always use the public API as documented (`import { toString } from 'nlcst-to-string'`). Avoid using private APIs or deep imports into the package's internal structure.Change `const toString = require('nlcst-to-string')` to `import { toString } from 'nlcst-to-string'`.Verify that `import { toString } from 'nlcst-to-string'` is correctly configured for an ESM environment and that Node.js 16+ is used for `nlcst-to-string@4`.Ensure your file is treated as an ES module by either renaming it to `.mjs` or adding `"type": "module"` to your project's `package.json`. Alternatively, for older Node.js versions or CJS-only environments, you might need to use an older version of `nlcst-to-string` (pre-v3) or a dynamic `import()` call.
No dependency data recorded yet.