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: [].concat(
          'table',
          'tableRow',
          'tableCell',
          settings.ignore || []
        ),
        source: [].concat('inlineCode', settings.source || [])
      },
      tree
    )
  )
}
// Transform a `tree` in mdast to nlcst.
Transform a `tree` in mdast to nlcst.
Transform a ` tree ` in mdast to nlcst .
function toNlcst(tree, file, Parser, options) {
  var settings = options || {}
  var parser
  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')
  }
  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()
  return parser.parse(
    one(
      {
        doc: String(file),
        location: vfileLocation(file),
        parser: parser,
        ignore: [].concat(
          'table',
          'tableRow',
          'tableCell',
          settings.ignore || []
        ),
        source: [].concat('inlineCode', settings.source || [])
      },
      tree
    )
  )
}
function toNlcst ( tree , file , Parser , options ) { var settings = options || { } var parser 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' ) } 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 ( ) return parser . parse ( one ( { doc : String ( file ) , location : vfileLocation ( file ) , parser : parser , ignore : [ ] . concat ( 'table' , 'tableRow' , 'tableCell' , settings . ignore || [ ] ) , source : [ ] . concat ( 'inlineCode' , settings . source || [ ] ) } , tree ) ) }
Transform a `tree` in mdast to nlcst.
Transform a ` tree ` in mdast to nlcst .
// Warn for invalid parameters. // Construct parser. // Transform mdast into nlcst tokens, and pass these into `parser.parse` to // insert sentences, paragraphs where needed.