index.js
function toNLCST(tree, file, Parser, options) {
  var settings = options || {}
  var parser

  // Warn for invalid parameters.
  if (!tree || !tree.type) {
    throw new Error('mdast-util-to-nlcst expected node')
  }

  if (!file || !file.messages) {
    throw new Error('mdast-util-to-nlcst expected file')
  }

  // Construct parser.
  if (!Parser) {
    throw new Error('mdast-util-to-nlcst expected parser')
  }

  if (
    !tree.position ||
    !tree.position.start ||
    !tree.position.start.column ||
    !tree.position.start.line
  ) {
    throw new Error('mdast-util-to-nlcst expected position on nodes')
  }

  parser = 'parse' in Parser ? Parser : new Parser()

  // Transform mdast into NLCST tokens, and pass these into `parser.parse` to
  // insert sentences, paragraphs where needed.
  return parser.parse(
    one(
      {
        doc: String(file),
        location: vfileLocation(file),
        parser: parser,
        ignore: ignore.concat(settings.ignore || []),
        source: source.concat(settings.source || [])
      },
      tree
    )
  )
}
function toNLCST(tree, file, Parser, options) {
  var settings = options || {}
  var parser

  // Warn for invalid parameters.
  if (!tree || !tree.type) {
    throw new Error('mdast-util-to-nlcst expected node')
  }

  if (!file || !file.messages) {
    throw new Error('mdast-util-to-nlcst expected file')
  }

  // Construct parser.
  if (!Parser) {
    throw new Error('mdast-util-to-nlcst expected parser')
  }

  if (
    !tree.position ||
    !tree.position.start ||
    !tree.position.start.column ||
    !tree.position.start.line
  ) {
    throw new Error('mdast-util-to-nlcst expected position on nodes')
  }

  parser = 'parse' in Parser ? Parser : new Parser()

  // Transform mdast into NLCST tokens, and pass these into `parser.parse` to
  // insert sentences, paragraphs where needed.
  return parser.parse(
    one(
      {
        doc: String(file),
        location: vfileLocation(file),
        parser: parser,
        ignore: ignore.concat(settings.ignore || []),
        source: source.concat(settings.source || [])
      },
      tree
    )
  )
}
function toNLCST ( tree , file , Parser , options ) { var settings = options || { } var parser // Warn for invalid parameters. if ( ! tree || ! tree . type ) { throw new Error ( 'mdast-util-to-nlcst expected node' ) } if ( ! file || ! file . messages ) { throw new Error ( 'mdast-util-to-nlcst expected file' ) } // Construct parser. if ( ! Parser ) { throw new Error ( 'mdast-util-to-nlcst expected parser' ) } if ( ! tree . position || ! tree . position . start || ! tree . position . start . column || ! tree . position . start . line ) { throw new Error ( 'mdast-util-to-nlcst expected position on nodes' ) } parser = 'parse' in Parser ? Parser : new Parser ( ) // Transform mdast into NLCST tokens, and pass these into `parser.parse` to // insert sentences, paragraphs where needed. return parser . parse ( one ( { doc : String ( file ) , location : vfileLocation ( file ) , parser : parser , ignore : ignore . concat ( settings . ignore || [ ] ) , source : source . concat ( settings . source || [ ] ) } , tree ) ) }
Transform `tree` into `nlcst`.
Transform tree into nlcst .