diff options
Diffstat (limited to 'tools/eslint/node_modules/remark-parse/lib/util')
5 files changed, 0 insertions, 261 deletions
diff --git a/tools/eslint/node_modules/remark-parse/lib/util/get-indentation.js b/tools/eslint/node_modules/remark-parse/lib/util/get-indentation.js deleted file mode 100644 index eebd40c94a..0000000000 --- a/tools/eslint/node_modules/remark-parse/lib/util/get-indentation.js +++ /dev/null @@ -1,46 +0,0 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:util:get-indentation - * @fileoverview Get indentation. - */ - -'use strict'; - -/* Expose. */ -module.exports = indentation; - -/* Map of characters, and their column length, - * which can be used as indentation. */ -var characters = {' ': 1, '\t': 4}; - -/** - * Gets indentation information for a line. - * - * @param {string} value - Indented line. - * @return {Object} - Indetation information. - */ -function indentation(value) { - var index = 0; - var indent = 0; - var character = value.charAt(index); - var stops = {}; - var size; - - while (character in characters) { - size = characters[character]; - - indent += size; - - if (size > 1) { - indent = Math.floor(indent / size) * size; - } - - stops[indent] = index; - - character = value.charAt(++index); - } - - return {indent: indent, stops: stops}; -} diff --git a/tools/eslint/node_modules/remark-parse/lib/util/html.js b/tools/eslint/node_modules/remark-parse/lib/util/html.js deleted file mode 100644 index 234ba342e1..0000000000 --- a/tools/eslint/node_modules/remark-parse/lib/util/html.js +++ /dev/null @@ -1,33 +0,0 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:util:html - * @fileoverview HTML regexes. - */ - -'use strict'; - -var attributeName = '[a-zA-Z_:][a-zA-Z0-9:._-]*'; -var unquoted = '[^"\'=<>`\\u0000-\\u0020]+'; -var singleQuoted = '\'[^\']*\''; -var doubleQuoted = '"[^"]*"'; -var attributeValue = '(?:' + unquoted + '|' + singleQuoted + '|' + doubleQuoted + ')'; -var attribute = '(?:\\s+' + attributeName + '(?:\\s*=\\s*' + attributeValue + ')?)'; -var openTag = '<[A-Za-z][A-Za-z0-9\\-]*' + attribute + '*\\s*\\/?>'; -var closeTag = '<\\/[A-Za-z][A-Za-z0-9\\-]*\\s*>'; -var comment = '<!---->|<!--(?:-?[^>-])(?:-?[^-])*-->'; -var processing = '<[?].*?[?]>'; -var declaration = '<![A-Za-z]+\\s+[^>]*>'; -var cdata = '<!\\[CDATA\\[[\\s\\S]*?\\]\\]>'; - -exports.openCloseTag = new RegExp('^(?:' + openTag + '|' + closeTag + ')'); - -exports.tag = new RegExp('^(?:' + - openTag + '|' + - closeTag + '|' + - comment + '|' + - processing + '|' + - declaration + '|' + - cdata + -')'); diff --git a/tools/eslint/node_modules/remark-parse/lib/util/interrupt.js b/tools/eslint/node_modules/remark-parse/lib/util/interrupt.js deleted file mode 100644 index b8dc230550..0000000000 --- a/tools/eslint/node_modules/remark-parse/lib/util/interrupt.js +++ /dev/null @@ -1,51 +0,0 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:util:get-indentation - * @fileoverview Get indentation. - */ - -'use strict'; - -module.exports = interrupt; - -function interrupt(interruptors, tokenizers, ctx, params) { - var bools = ['pedantic', 'commonmark']; - var count = bools.length; - var length = interruptors.length; - var index = -1; - var interruptor; - var config; - var fn; - var offset; - var bool; - var ignore; - - while (++index < length) { - interruptor = interruptors[index]; - config = interruptor[1] || {}; - fn = interruptor[0]; - offset = -1; - ignore = false; - - while (++offset < count) { - bool = bools[offset]; - - if (config[bool] !== undefined && config[bool] !== ctx.options[bool]) { - ignore = true; - break; - } - } - - if (ignore) { - continue; - } - - if (tokenizers[fn].apply(ctx, params)) { - return true; - } - } - - return false; -} diff --git a/tools/eslint/node_modules/remark-parse/lib/util/normalize.js b/tools/eslint/node_modules/remark-parse/lib/util/normalize.js deleted file mode 100644 index 3602a18f78..0000000000 --- a/tools/eslint/node_modules/remark-parse/lib/util/normalize.js +++ /dev/null @@ -1,29 +0,0 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:util:normalize - * @fileoverview Normalize an identifier. - */ - -'use strict'; - -/* Dependencies. */ -var collapseWhiteSpace = require('collapse-white-space'); - -/* Expose. */ -module.exports = normalize; - -/** - * Normalize an identifier. Collapses multiple white space - * characters into a single space, and removes casing. - * - * @example - * normalizeIdentifier('FOO\t bar'); // 'foo bar' - * - * @param {string} value - Content to normalize. - * @return {string} - Normalized content. - */ -function normalize(value) { - return collapseWhiteSpace(value).toLowerCase(); -} diff --git a/tools/eslint/node_modules/remark-parse/lib/util/remove-indentation.js b/tools/eslint/node_modules/remark-parse/lib/util/remove-indentation.js deleted file mode 100644 index d56db0bad4..0000000000 --- a/tools/eslint/node_modules/remark-parse/lib/util/remove-indentation.js +++ /dev/null @@ -1,102 +0,0 @@ -/** - * @author Titus Wormer - * @copyright 2015 Titus Wormer - * @license MIT - * @module remark:parse:util:remove-indentation - * @fileoverview Remove indentation. - */ - -'use strict'; - -/* Dependencies. */ -var trim = require('trim'); -var repeat = require('repeat-string'); -var getIndent = require('./get-indentation'); - -/* Expose. */ -module.exports = indentation; - -/* Characters. */ -var C_SPACE = ' '; -var C_NEWLINE = '\n'; -var C_TAB = '\t'; - -/** - * Remove the minimum indent from every line in `value`. - * Supports both tab, spaced, and mixed indentation (as - * well as possible). - * - * @example - * removeIndentation(' foo'); // 'foo' - * removeIndentation(' foo', 2); // ' foo' - * removeIndentation('\tfoo', 2); // ' foo' - * removeIndentation(' foo\n bar'); // ' foo\n bar' - * - * @param {string} value - Value to trim. - * @param {number?} [maximum] - Maximum indentation - * to remove. - * @return {string} - Unindented `value`. - */ -function indentation(value, maximum) { - var values = value.split(C_NEWLINE); - var position = values.length + 1; - var minIndent = Infinity; - var matrix = []; - var index; - var indentation; - var stops; - var padding; - - values.unshift(repeat(C_SPACE, maximum) + '!'); - - while (position--) { - indentation = getIndent(values[position]); - - matrix[position] = indentation.stops; - - if (trim(values[position]).length === 0) { - continue; - } - - if (indentation.indent) { - if (indentation.indent > 0 && indentation.indent < minIndent) { - minIndent = indentation.indent; - } - } else { - minIndent = Infinity; - - break; - } - } - - if (minIndent !== Infinity) { - position = values.length; - - while (position--) { - stops = matrix[position]; - index = minIndent; - - while (index && !(index in stops)) { - index--; - } - - if ( - trim(values[position]).length !== 0 && - minIndent && - index !== minIndent - ) { - padding = C_TAB; - } else { - padding = ''; - } - - values[position] = padding + values[position].slice( - index in stops ? stops[index] + 1 : 0 - ); - } - } - - values.shift(); - - return values.join(C_NEWLINE); -} |