Files
react-native-devtools-frontend/node_modules/remark-parse/lib/parse.js
T
Mathias Bynens 79e2cf0633 Add stylelint dependency
This also adds CC-BY-4.0 to the list of accepted licenses.

DISABLE_THIRD_PARTY_CHECK=update dependencies

Bug: chromium:1083142
Change-Id: I8612de2fba52dae32eeb71af79d5aacfde52142b
Reviewed-on: https://chromium-review.googlesource.com/c/devtools/devtools-frontend/+/2220097
Reviewed-by: Paul Lewis <aerotwist@chromium.org>
Commit-Queue: Mathias Bynens <mathias@chromium.org>
2020-06-11 06:20:04 +00:00

43 lines
900 B
JavaScript

'use strict'
var xtend = require('xtend')
var removePosition = require('unist-util-remove-position')
module.exports = parse
var lineFeed = '\n'
var lineBreaksExpression = /\r\n|\r/g
// Parse the bound file.
function parse() {
var self = this
var value = String(self.file)
var start = {line: 1, column: 1, offset: 0}
var content = xtend(start)
var node
// Clean non-unix newlines: `\r\n` and `\r` are all changed to `\n`.
// This should not affect positional information.
value = value.replace(lineBreaksExpression, lineFeed)
// BOM.
if (value.charCodeAt(0) === 0xfeff) {
value = value.slice(1)
content.column++
content.offset++
}
node = {
type: 'root',
children: self.tokenizeBlock(value, content),
position: {start: start, end: self.eof || xtend(start)}
}
if (!self.options.position) {
removePosition(node, true)
}
return node
}