JSPM

  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 836596
  • Score
    100M100P100Q192531F
  • License MIT

nlcst utility to transform a tree to a string

Package Exports

  • nlcst-to-string

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (nlcst-to-string) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

nlcst-to-string

Build Coverage Downloads Size Sponsors Backers Chat

nlcst utility to serialize a node.

Install

This package is ESM only: Node 12+ is needed to use it and it must be imported instead of required.

npm:

npm install nlcst-to-string

Use

import {toString} from 'nlcst-to-string'

console.log(
  toString({
    type: 'WordNode',
    children: [
      {type: 'TextNode', value: 'AT'},
      {type: 'PunctuationNode', value: '&'},
      {type: 'TextNode', value: 'T'}
    ]
  })
) // => 'AT&T'

API

This package exports the following identifiers: toString. There is no default export.

toString(node[, separator])

Stringify the given nlcst node (or list of nodes).

Parameters
  • node (Node or Array.<Node>)
  • separator (string, default: '') — Value to delimit each item
Returns

string.

Contribute

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.

License

MIT © Titus Wormer