Browse Source

tools: update to ESLint 4.3.0

PR-URL: https://github.com/nodejs/node/pull/14417
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Teddy Katz <teddy.katz@gmail.com>
Reviewed-By: Roman Reiss <me@silverwind.io>
Reviewed-By: Refael Ackermann <refack@gmail.com>
v6
Rich Trott 8 years ago
parent
commit
c49adbff63
  1. 7
      tools/eslint/bin/eslint.js
  2. 137
      tools/eslint/lib/config/config-initializer.js
  3. 12
      tools/eslint/lib/config/plugins.js
  4. 632
      tools/eslint/lib/rules/indent.js
  5. 68
      tools/eslint/lib/rules/no-constant-condition.js
  6. 59
      tools/eslint/lib/rules/no-restricted-globals.js
  7. 29
      tools/eslint/lib/rules/no-underscore-dangle.js
  8. 18
      tools/eslint/lib/rules/object-curly-newline.js
  9. 102
      tools/eslint/lib/rules/prefer-destructuring.js
  10. 43
      tools/eslint/lib/rules/prefer-numeric-literals.js
  11. 17
      tools/eslint/lib/util/npm-util.js
  12. 8
      tools/eslint/node_modules/ajv/dist/ajv.bundle.js
  13. 4
      tools/eslint/node_modules/ajv/dist/ajv.min.js
  14. 2
      tools/eslint/node_modules/ajv/dist/ajv.min.js.map
  15. 8
      tools/eslint/node_modules/ajv/lib/compile/index.js
  16. 10
      tools/eslint/node_modules/ajv/package.json
  17. 32
      tools/eslint/node_modules/character-entities-legacy/package.json
  18. 27
      tools/eslint/node_modules/character-entities-legacy/readme.md
  19. 32
      tools/eslint/node_modules/character-entities/package.json
  20. 29
      tools/eslint/node_modules/character-entities/readme.md
  21. 40
      tools/eslint/node_modules/character-reference-invalid/package.json
  22. 29
      tools/eslint/node_modules/character-reference-invalid/readme.md
  23. 43
      tools/eslint/node_modules/color-name/.eslintrc.json
  24. 2
      tools/eslint/node_modules/color-name/index.js
  25. 13
      tools/eslint/node_modules/color-name/package.json
  26. 19
      tools/eslint/node_modules/cross-spawn/LICENSE
  27. 85
      tools/eslint/node_modules/cross-spawn/README.md
  28. 59
      tools/eslint/node_modules/cross-spawn/index.js
  29. 73
      tools/eslint/node_modules/cross-spawn/lib/enoent.js
  30. 113
      tools/eslint/node_modules/cross-spawn/lib/parse.js
  31. 30
      tools/eslint/node_modules/cross-spawn/lib/util/escapeArgument.js
  32. 12
      tools/eslint/node_modules/cross-spawn/lib/util/escapeCommand.js
  33. 18
      tools/eslint/node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js
  34. 37
      tools/eslint/node_modules/cross-spawn/lib/util/readShebang.js
  35. 31
      tools/eslint/node_modules/cross-spawn/lib/util/resolveCommand.js
  36. 83
      tools/eslint/node_modules/cross-spawn/package.json
  37. 22
      tools/eslint/node_modules/functional-red-black-tree/LICENSE
  38. 237
      tools/eslint/node_modules/functional-red-black-tree/README.md
  39. 11
      tools/eslint/node_modules/functional-red-black-tree/bench/test.js
  40. 68
      tools/eslint/node_modules/functional-red-black-tree/package.json
  41. 996
      tools/eslint/node_modules/functional-red-black-tree/rbtree.js
  42. 6
      tools/eslint/node_modules/is-alphabetical/history.md
  43. 20
      tools/eslint/node_modules/is-alphabetical/index.js
  44. 43
      tools/eslint/node_modules/is-alphabetical/package.json
  45. 13
      tools/eslint/node_modules/is-alphabetical/readme.md
  46. 6
      tools/eslint/node_modules/is-alphanumerical/history.md
  47. 21
      tools/eslint/node_modules/is-alphanumerical/index.js
  48. 40
      tools/eslint/node_modules/is-alphanumerical/package.json
  49. 16
      tools/eslint/node_modules/is-alphanumerical/readme.md
  50. 6
      tools/eslint/node_modules/is-decimal/history.md
  51. 20
      tools/eslint/node_modules/is-decimal/index.js
  52. 40
      tools/eslint/node_modules/is-decimal/package.json
  53. 20
      tools/eslint/node_modules/is-decimal/readme.md
  54. 6
      tools/eslint/node_modules/is-hexadecimal/history.md
  55. 20
      tools/eslint/node_modules/is-hexadecimal/index.js
  56. 40
      tools/eslint/node_modules/is-hexadecimal/package.json
  57. 21
      tools/eslint/node_modules/is-hexadecimal/readme.md
  58. 6
      tools/eslint/node_modules/is-whitespace-character/history.md
  59. 23
      tools/eslint/node_modules/is-whitespace-character/index.js
  60. 40
      tools/eslint/node_modules/is-whitespace-character/package.json
  61. 8
      tools/eslint/node_modules/is-whitespace-character/readme.md
  62. 6
      tools/eslint/node_modules/is-word-character/history.md
  63. 23
      tools/eslint/node_modules/is-word-character/index.js
  64. 40
      tools/eslint/node_modules/is-word-character/package.json
  65. 20
      tools/eslint/node_modules/is-word-character/readme.md
  66. 15
      tools/eslint/node_modules/isexe/LICENSE
  67. 51
      tools/eslint/node_modules/isexe/README.md
  68. 57
      tools/eslint/node_modules/isexe/index.js
  69. 41
      tools/eslint/node_modules/isexe/mode.js
  70. 60
      tools/eslint/node_modules/isexe/package.json
  71. 42
      tools/eslint/node_modules/isexe/windows.js
  72. 504
      tools/eslint/node_modules/jschardet/LICENSE
  73. 101
      tools/eslint/node_modules/jschardet/dist/jschardet.js
  74. 1344
      tools/eslint/node_modules/jschardet/dist/jschardet.min.js
  75. 10
      tools/eslint/node_modules/jschardet/package.json
  76. 10
      tools/eslint/node_modules/jschardet/src/chardistribution.js
  77. 4
      tools/eslint/node_modules/jschardet/src/mbcssm.js
  78. 15
      tools/eslint/node_modules/lru-cache/LICENSE
  79. 152
      tools/eslint/node_modules/lru-cache/README.md
  80. 467
      tools/eslint/node_modules/lru-cache/index.js
  81. 68
      tools/eslint/node_modules/lru-cache/package.json
  82. 6
      tools/eslint/node_modules/markdown-escapes/history.md
  83. 20
      tools/eslint/node_modules/markdown-escapes/index.js
  84. 40
      tools/eslint/node_modules/markdown-escapes/package.json
  85. 12
      tools/eslint/node_modules/markdown-escapes/readme.md
  86. 15
      tools/eslint/node_modules/pseudomap/LICENSE
  87. 60
      tools/eslint/node_modules/pseudomap/README.md
  88. 9
      tools/eslint/node_modules/pseudomap/map.js
  89. 54
      tools/eslint/node_modules/pseudomap/package.json
  90. 113
      tools/eslint/node_modules/pseudomap/pseudomap.js
  91. 15
      tools/eslint/node_modules/semver/LICENSE
  92. 350
      tools/eslint/node_modules/semver/README.md
  93. 133
      tools/eslint/node_modules/semver/bin/semver
  94. 54
      tools/eslint/node_modules/semver/package.json
  95. 16
      tools/eslint/node_modules/semver/range.bnf
  96. 1203
      tools/eslint/node_modules/semver/semver.js
  97. 19
      tools/eslint/node_modules/shebang-command/index.js
  98. 21
      tools/eslint/node_modules/shebang-command/license
  99. 71
      tools/eslint/node_modules/shebang-command/package.json
  100. 39
      tools/eslint/node_modules/shebang-command/readme.md

7
tools/eslint/bin/eslint.js

@ -44,11 +44,10 @@ process.once("uncaughtException", err => {
if (typeof err.messageTemplate === "string" && err.messageTemplate.length > 0) { if (typeof err.messageTemplate === "string" && err.messageTemplate.length > 0) {
const template = lodash.template(fs.readFileSync(path.resolve(__dirname, `../messages/${err.messageTemplate}.txt`), "utf-8")); const template = lodash.template(fs.readFileSync(path.resolve(__dirname, `../messages/${err.messageTemplate}.txt`), "utf-8"));
console.log("\nOops! Something went wrong! :("); console.error("\nOops! Something went wrong! :(");
console.log(`\n${template(err.messageData || {})}`); console.error(`\n${template(err.messageData || {})}`);
} else { } else {
console.log(err.message); console.error(err.stack);
console.log(err.stack);
} }
process.exitCode = 1; process.exitCode = 1;

137
tools/eslint/lib/config/config-initializer.js

@ -12,10 +12,12 @@
const util = require("util"), const util = require("util"),
inquirer = require("inquirer"), inquirer = require("inquirer"),
ProgressBar = require("progress"), ProgressBar = require("progress"),
semver = require("semver"),
autoconfig = require("./autoconfig.js"), autoconfig = require("./autoconfig.js"),
ConfigFile = require("./config-file"), ConfigFile = require("./config-file"),
ConfigOps = require("./config-ops"), ConfigOps = require("./config-ops"),
getSourceCodeOfFiles = require("../util/source-code-util").getSourceCodeOfFiles, getSourceCodeOfFiles = require("../util/source-code-util").getSourceCodeOfFiles,
ModuleResolver = require("../util/module-resolver"),
npmUtil = require("../util/npm-util"), npmUtil = require("../util/npm-util"),
recConfig = require("../../conf/eslint-recommended"), recConfig = require("../../conf/eslint-recommended"),
log = require("../logging"); log = require("../logging");
@ -56,12 +58,35 @@ function writeFile(config, format) {
} }
} }
/**
* Get the peer dependencies of the given module.
* This adds the gotten value to cache at the first time, then reuses it.
* In a process, this function is called twice, but `npmUtil.fetchPeerDependencies` needs to access network which is relatively slow.
* @param {string} moduleName The module name to get.
* @returns {Object} The peer dependencies of the given module.
* This object is the object of `peerDependencies` field of `package.json`.
*/
function getPeerDependencies(moduleName) {
let result = getPeerDependencies.cache.get(moduleName);
if (!result) {
log.info(`Checking peerDependencies of ${moduleName}`);
result = npmUtil.fetchPeerDependencies(moduleName);
getPeerDependencies.cache.set(moduleName, result);
}
return result;
}
getPeerDependencies.cache = new Map();
/** /**
* Synchronously install necessary plugins, configs, parsers, etc. based on the config * Synchronously install necessary plugins, configs, parsers, etc. based on the config
* @param {Object} config config object * @param {Object} config config object
* @param {boolean} [installESLint=true] If `false` is given, it does not install eslint.
* @returns {void} * @returns {void}
*/ */
function installModules(config) { function installModules(config, installESLint) {
const modules = {}; const modules = {};
// Create a list of modules which should be installed based on config // Create a list of modules which should be installed based on config
@ -73,11 +98,10 @@ function installModules(config) {
if (config.extends && config.extends.indexOf("eslint:") === -1) { if (config.extends && config.extends.indexOf("eslint:") === -1) {
const moduleName = `eslint-config-${config.extends}`; const moduleName = `eslint-config-${config.extends}`;
log.info(`Checking peerDependencies of ${moduleName}`);
modules[moduleName] = "latest"; modules[moduleName] = "latest";
Object.assign( Object.assign(
modules, modules,
npmUtil.fetchPeerDependencies(`${moduleName}@latest`) getPeerDependencies(`${moduleName}@latest`)
); );
} }
@ -86,15 +110,17 @@ function installModules(config) {
return; return;
} }
// Add eslint to list in case user does not have it installed locally if (installESLint === false) {
modules.eslint = modules.eslint || "latest"; delete modules.eslint;
} else {
// Mark to show messages if it's new installation of eslint. const installStatus = npmUtil.checkDevDeps(["eslint"]);
const installStatus = npmUtil.checkDevDeps(["eslint"]);
if (installStatus.eslint === false) { // Mark to show messages if it's new installation of eslint.
log.info("Local ESLint installation not found."); if (installStatus.eslint === false) {
config.installedESLint = true; log.info("Local ESLint installation not found.");
modules.eslint = modules.eslint || "latest";
config.installedESLint = true;
}
} }
// Install packages // Install packages
@ -265,9 +291,10 @@ function processAnswers(answers) {
/** /**
* process user's style guide of choice and return an appropriate config object. * process user's style guide of choice and return an appropriate config object.
* @param {string} guide name of the chosen style guide * @param {string} guide name of the chosen style guide
* @param {boolean} [installESLint=true] If `false` is given, it does not install eslint.
* @returns {Object} config object * @returns {Object} config object
*/ */
function getConfigForStyleGuide(guide) { function getConfigForStyleGuide(guide, installESLint) {
const guides = { const guides = {
google: { extends: "google" }, google: { extends: "google" },
airbnb: { extends: "airbnb" }, airbnb: { extends: "airbnb" },
@ -279,11 +306,74 @@ function getConfigForStyleGuide(guide) {
throw new Error("You referenced an unsupported guide."); throw new Error("You referenced an unsupported guide.");
} }
installModules(guides[guide]); installModules(guides[guide], installESLint);
return guides[guide]; return guides[guide];
} }
/**
* Get the version of the local ESLint.
* @returns {string|null} The version. If the local ESLint was not found, returns null.
*/
function getLocalESLintVersion() {
try {
const resolver = new ModuleResolver();
const eslintPath = resolver.resolve("eslint", process.cwd());
const eslint = require(eslintPath);
return eslint.linter.version || null;
} catch (_err) {
return null;
}
}
/**
* Get the shareable config name of the chosen style guide.
* @param {Object} answers The answers object.
* @returns {string} The shareable config name.
*/
function getStyleGuideName(answers) {
if (answers.styleguide === "airbnb" && !answers.airbnbReact) {
return "airbnb-base";
}
return answers.styleguide;
}
/**
* Check whether the local ESLint version conflicts with the required version of the chosen shareable config.
* @param {Object} answers The answers object.
* @returns {boolean} `true` if the local ESLint is found then it conflicts with the required version of the chosen shareable config.
*/
function hasESLintVersionConflict(answers) {
// Get the local ESLint version.
const localESLintVersion = getLocalESLintVersion();
if (!localESLintVersion) {
return false;
}
// Get the required range of ESLint version.
const configName = getStyleGuideName(answers);
const moduleName = `eslint-config-${configName}@latest`;
const requiredESLintVersionRange = getPeerDependencies(moduleName).eslint;
if (!requiredESLintVersionRange) {
return false;
}
answers.localESLintVersion = localESLintVersion;
answers.requiredESLintVersionRange = requiredESLintVersionRange;
// Check the version.
if (semver.satisfies(localESLintVersion, requiredESLintVersionRange)) {
answers.installESLint = false;
return false;
}
return true;
}
/* istanbul ignore next: no need to test inquirer*/ /* istanbul ignore next: no need to test inquirer*/
/** /**
* Ask use a few questions on command prompt * Ask use a few questions on command prompt
@ -346,6 +436,21 @@ function promptUser() {
when(answers) { when(answers) {
return ((answers.source === "guide" && answers.packageJsonExists) || answers.source === "auto"); return ((answers.source === "guide" && answers.packageJsonExists) || answers.source === "auto");
} }
},
{
type: "confirm",
name: "installESLint",
message(answers) {
const verb = semver.ltr(answers.localESLintVersion, answers.requiredESLintVersionRange)
? "upgrade"
: "downgrade";
return `The style guide "${answers.styleguide}" requires eslint@${answers.requiredESLintVersionRange}. You are currently using eslint@${answers.localESLintVersion}.\n Do you want to ${verb}?`;
},
default: true,
when(answers) {
return answers.source === "guide" && answers.packageJsonExists && hasESLintVersionConflict(answers);
}
} }
]).then(earlyAnswers => { ]).then(earlyAnswers => {
@ -355,11 +460,14 @@ function promptUser() {
log.info("A package.json is necessary to install plugins such as style guides. Run `npm init` to create a package.json file and try again."); log.info("A package.json is necessary to install plugins such as style guides. Run `npm init` to create a package.json file and try again.");
return void 0; return void 0;
} }
if (earlyAnswers.installESLint === false && !semver.satisfies(earlyAnswers.localESLintVersion, earlyAnswers.requiredESLintVersionRange)) {
log.info(`Note: it might not work since ESLint's version is mismatched with the ${earlyAnswers.styleguide} config.`);
}
if (earlyAnswers.styleguide === "airbnb" && !earlyAnswers.airbnbReact) { if (earlyAnswers.styleguide === "airbnb" && !earlyAnswers.airbnbReact) {
earlyAnswers.styleguide = "airbnb-base"; earlyAnswers.styleguide = "airbnb-base";
} }
config = getConfigForStyleGuide(earlyAnswers.styleguide); config = getConfigForStyleGuide(earlyAnswers.styleguide, earlyAnswers.installESLint);
writeFile(config, earlyAnswers.format); writeFile(config, earlyAnswers.format);
return void 0; return void 0;
@ -479,6 +587,7 @@ function promptUser() {
const init = { const init = {
getConfigForStyleGuide, getConfigForStyleGuide,
hasESLintVersionConflict,
processAnswers, processAnswers,
/* istanbul ignore next */initializeConfig() { /* istanbul ignore next */initializeConfig() {
return promptUser(); return promptUser();

12
tools/eslint/lib/config/plugins.js

@ -156,8 +156,20 @@ class Plugins {
* @param {string[]} pluginNames An array of plugins names. * @param {string[]} pluginNames An array of plugins names.
* @returns {void} * @returns {void}
* @throws {Error} If a plugin cannot be loaded. * @throws {Error} If a plugin cannot be loaded.
* @throws {Error} If "plugins" in config is not an array
*/ */
loadAll(pluginNames) { loadAll(pluginNames) {
// if "plugins" in config is not an array, throw an error so user can fix their config.
if (!Array.isArray(pluginNames)) {
const pluginNotArrayMessage = "ESLint configuration error: \"plugins\" value must be an array";
debug(`${pluginNotArrayMessage}: ${JSON.stringify(pluginNames)}`);
throw new Error(pluginNotArrayMessage);
}
// load each plugin by name
pluginNames.forEach(this.load, this); pluginNames.forEach(this.load, this);
} }
} }

632
tools/eslint/lib/rules/indent.js

File diff suppressed because it is too large

68
tools/eslint/lib/rules/no-constant-condition.js

@ -33,7 +33,10 @@ module.exports = {
create(context) { create(context) {
const options = context.options[0] || {}, const options = context.options[0] || {},
checkLoops = options.checkLoops !== false; checkLoops = options.checkLoops !== false,
loopSetStack = [];
let loopsInCurrentScope = new Set();
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// Helpers // Helpers
@ -114,18 +117,64 @@ module.exports = {
return false; return false;
} }
/**
* Tracks when the given node contains a constant condition.
* @param {ASTNode} node The AST node to check.
* @returns {void}
* @private
*/
function trackConstantConditionLoop(node) {
if (node.test && isConstant(node.test, true)) {
loopsInCurrentScope.add(node);
}
}
/**
* Reports when the set contains the given constant condition node
* @param {ASTNode} node The AST node to check.
* @returns {void}
* @private
*/
function checkConstantConditionLoopInSet(node) {
if (loopsInCurrentScope.has(node)) {
loopsInCurrentScope.delete(node);
context.report({ node, message: "Unexpected constant condition." });
}
}
/** /**
* Reports when the given node contains a constant condition. * Reports when the given node contains a constant condition.
* @param {ASTNode} node The AST node to check. * @param {ASTNode} node The AST node to check.
* @returns {void} * @returns {void}
* @private * @private
*/ */
function checkConstantCondition(node) { function reportIfConstant(node) {
if (node.test && isConstant(node.test, true)) { if (node.test && isConstant(node.test, true)) {
context.report({ node, message: "Unexpected constant condition." }); context.report({ node, message: "Unexpected constant condition." });
} }
} }
/**
* Stores current set of constant loops in loopSetStack temporarily
* and uses a new set to track constant loops
* @returns {void}
* @private
*/
function enterFunction() {
loopSetStack.push(loopsInCurrentScope);
loopsInCurrentScope = new Set();
}
/**
* Reports when the set still contains stored constant conditions
* @param {ASTNode} node The AST node to check.
* @returns {void}
* @private
*/
function exitFunction() {
loopsInCurrentScope = loopSetStack.pop();
}
/** /**
* Checks node when checkLoops option is enabled * Checks node when checkLoops option is enabled
* @param {ASTNode} node The AST node to check. * @param {ASTNode} node The AST node to check.
@ -134,7 +183,7 @@ module.exports = {
*/ */
function checkLoop(node) { function checkLoop(node) {
if (checkLoops) { if (checkLoops) {
checkConstantCondition(node); trackConstantConditionLoop(node);
} }
} }
@ -143,11 +192,18 @@ module.exports = {
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
return { return {
ConditionalExpression: checkConstantCondition, ConditionalExpression: reportIfConstant,
IfStatement: checkConstantCondition, IfStatement: reportIfConstant,
WhileStatement: checkLoop, WhileStatement: checkLoop,
"WhileStatement:exit": checkConstantConditionLoopInSet,
DoWhileStatement: checkLoop, DoWhileStatement: checkLoop,
ForStatement: checkLoop "DoWhileStatement:exit": checkConstantConditionLoopInSet,
ForStatement: checkLoop,
"ForStatement > .test": node => checkLoop(node.parent),
"ForStatement:exit": checkConstantConditionLoopInSet,
FunctionDeclaration: enterFunction,
"FunctionDeclaration:exit": exitFunction,
YieldExpression: () => loopsInCurrentScope.clear()
}; };
} }

59
tools/eslint/lib/rules/no-restricted-globals.js

@ -4,6 +4,13 @@
*/ */
"use strict"; "use strict";
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
const DEFAULT_MESSAGE_TEMPLATE = "Unexpected use of '{{name}}'.",
CUSTOM_MESSAGE_TEMPLATE = "Unexpected use of '{{name}}'. {{customMessage}}";
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Rule Definition // Rule Definition
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -19,20 +26,43 @@ module.exports = {
schema: { schema: {
type: "array", type: "array",
items: { items: {
type: "string" oneOf: [
{
type: "string"
},
{
type: "object",
properties: {
name: { type: "string" },
message: { type: "string" }
},
required: ["name"],
additionalProperties: false
}
]
}, },
uniqueItems: true uniqueItems: true,
minItems: 0
} }
}, },
create(context) { create(context) {
const restrictedGlobals = context.options;
// if no globals are restricted we don't need to check // If no globals are restricted, we don't need to do anything
if (restrictedGlobals.length === 0) { if (context.options.length === 0) {
return {}; return {};
} }
const restrictedGlobalMessages = context.options.reduce((memo, option) => {
if (typeof option === "string") {
memo[option] = null;
} else {
memo[option.name] = option.message;
}
return memo;
}, {});
/** /**
* Report a variable to be used as a restricted global. * Report a variable to be used as a restricted global.
* @param {Reference} reference the variable reference * @param {Reference} reference the variable reference
@ -40,9 +70,20 @@ module.exports = {
* @private * @private
*/ */
function reportReference(reference) { function reportReference(reference) {
context.report({ node: reference.identifier, message: "Unexpected use of '{{name}}'.", data: { const name = reference.identifier.name,
name: reference.identifier.name customMessage = restrictedGlobalMessages[name],
} }); message = customMessage
? CUSTOM_MESSAGE_TEMPLATE
: DEFAULT_MESSAGE_TEMPLATE;
context.report({
node: reference.identifier,
message,
data: {
name,
customMessage
}
});
} }
/** /**
@ -52,7 +93,7 @@ module.exports = {
* @private * @private
*/ */
function isRestricted(name) { function isRestricted(name) {
return restrictedGlobals.indexOf(name) >= 0; return restrictedGlobalMessages.hasOwnProperty(name);
} }
return { return {

29
tools/eslint/lib/rules/no-underscore-dangle.js

@ -32,6 +32,9 @@ module.exports = {
}, },
allowAfterSuper: { allowAfterSuper: {
type: "boolean" type: "boolean"
},
enforceInMethodNames: {
type: "boolean"
} }
}, },
additionalProperties: false additionalProperties: false
@ -45,6 +48,7 @@ module.exports = {
const ALLOWED_VARIABLES = options.allow ? options.allow : []; const ALLOWED_VARIABLES = options.allow ? options.allow : [];
const allowAfterThis = typeof options.allowAfterThis !== "undefined" ? options.allowAfterThis : false; const allowAfterThis = typeof options.allowAfterThis !== "undefined" ? options.allowAfterThis : false;
const allowAfterSuper = typeof options.allowAfterSuper !== "undefined" ? options.allowAfterSuper : false; const allowAfterSuper = typeof options.allowAfterSuper !== "undefined" ? options.allowAfterSuper : false;
const enforceInMethodNames = typeof options.enforceInMethodNames !== "undefined" ? options.enforceInMethodNames : false;
//------------------------------------------------------------------------- //-------------------------------------------------------------------------
// Helpers // Helpers
@ -162,6 +166,27 @@ module.exports = {
} }
} }
/**
* Check if method declaration or method property has a underscore at the end
* @param {ASTNode} node node to evaluate
* @returns {void}
* @private
*/
function checkForTrailingUnderscoreInMethod(node) {
const identifier = node.key.name;
const isMethod = node.type === "MethodDefinition" || node.type === "Property" && node.method;
if (typeof identifier !== "undefined" && enforceInMethodNames && isMethod && hasTrailingUnderscore(identifier)) {
context.report({
node,
message: "Unexpected dangling '_' in '{{identifier}}'.",
data: {
identifier
}
});
}
}
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
// Public API // Public API
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -169,7 +194,9 @@ module.exports = {
return { return {
FunctionDeclaration: checkForTrailingUnderscoreInFunctionDeclaration, FunctionDeclaration: checkForTrailingUnderscoreInFunctionDeclaration,
VariableDeclarator: checkForTrailingUnderscoreInVariableExpression, VariableDeclarator: checkForTrailingUnderscoreInVariableExpression,
MemberExpression: checkForTrailingUnderscoreInMemberExpression MemberExpression: checkForTrailingUnderscoreInMemberExpression,
MethodDefinition: checkForTrailingUnderscoreInMethod,
Property: checkForTrailingUnderscoreInMethod
}; };
} }

18
tools/eslint/lib/rules/object-curly-newline.js

@ -143,6 +143,8 @@ module.exports = {
first.loc.start.line !== last.loc.end.line first.loc.start.line !== last.loc.end.line
) )
); );
const hasCommentsFirstToken = astUtils.isCommentToken(first);
const hasCommentsLastToken = astUtils.isCommentToken(last);
/* /*
* Use tokens or comments to check multiline or not. * Use tokens or comments to check multiline or not.
@ -162,6 +164,10 @@ module.exports = {
node, node,
loc: openBrace.loc.start, loc: openBrace.loc.start,
fix(fixer) { fix(fixer) {
if (hasCommentsFirstToken) {
return null;
}
return fixer.insertTextAfter(openBrace, "\n"); return fixer.insertTextAfter(openBrace, "\n");
} }
}); });
@ -172,6 +178,10 @@ module.exports = {
node, node,
loc: closeBrace.loc.start, loc: closeBrace.loc.start,
fix(fixer) { fix(fixer) {
if (hasCommentsLastToken) {
return null;
}
return fixer.insertTextBefore(closeBrace, "\n"); return fixer.insertTextBefore(closeBrace, "\n");
} }
}); });
@ -190,6 +200,10 @@ module.exports = {
node, node,
loc: openBrace.loc.start, loc: openBrace.loc.start,
fix(fixer) { fix(fixer) {
if (hasCommentsFirstToken) {
return null;
}
return fixer.removeRange([ return fixer.removeRange([
openBrace.range[1], openBrace.range[1],
first.range[0] first.range[0]
@ -206,6 +220,10 @@ module.exports = {
node, node,
loc: closeBrace.loc.start, loc: closeBrace.loc.start,
fix(fixer) { fix(fixer) {
if (hasCommentsLastToken) {
return null;
}
return fixer.removeRange([ return fixer.removeRange([
last.range[1], last.range[1],
closeBrace.range[0] closeBrace.range[0]

102
tools/eslint/lib/rules/prefer-destructuring.js

@ -15,19 +15,55 @@ module.exports = {
category: "ECMAScript 6", category: "ECMAScript 6",
recommended: false recommended: false
}, },
schema: [ schema: [
{ {
type: "object",
properties: { // old support {array: Boolean, object: Boolean}
array: { // new support {VariableDeclarator: {}, AssignmentExpression: {}}
type: "boolean" oneOf: [
{
type: "object",
properties: {
VariableDeclarator: {
type: "object",
properties: {
array: {
type: "boolean"
},
object: {
type: "boolean"
}
},
additionalProperties: false
},
AssignmentExpression: {
type: "object",
properties: {
array: {
type: "boolean"
},
object: {
type: "boolean"
}
},
additionalProperties: false
}
},
additionalProperties: false
}, },
object: { {
type: "boolean" type: "object",
properties: {
array: {
type: "boolean"
},
object: {
type: "boolean"
}
},
additionalProperties: false
} }
}, ]
additionalProperties: false
}, },
{ {
type: "object", type: "object",
@ -42,26 +78,17 @@ module.exports = {
}, },
create(context) { create(context) {
let checkArrays = true;
let checkObjects = true;
let enforceForRenamedProperties = false;
const enabledTypes = context.options[0]; const enabledTypes = context.options[0];
const additionalOptions = context.options[1]; const enforceForRenamedProperties = context.options[1] && context.options[1].enforceForRenamedProperties;
let normalizedOptions = {
VariableDeclarator: { array: true, object: true },
AssignmentExpression: { array: true, object: true }
};
if (enabledTypes) { if (enabledTypes) {
if (typeof enabledTypes.array !== "undefined") { normalizedOptions = typeof enabledTypes.array !== "undefined" || typeof enabledTypes.object !== "undefined"
checkArrays = enabledTypes.array; ? { VariableDeclarator: enabledTypes, AssignmentExpression: enabledTypes }
} : enabledTypes;
if (typeof enabledTypes.object !== "undefined") {
checkObjects = enabledTypes.object;
}
}
if (additionalOptions) {
if (typeof additionalOptions.enforceForRenamedProperties !== "undefined") {
enforceForRenamedProperties = additionalOptions.enforceForRenamedProperties;
}
} }
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
@ -69,7 +96,18 @@ module.exports = {
//-------------------------------------------------------------------------- //--------------------------------------------------------------------------
/** /**
* Determines if the given node node is accessing an array index * @param {string} nodeType "AssignmentExpression" or "VariableDeclarator"
* @param {string} destructuringType "array" or "object"
* @returns {boolean} `true` if the destructuring type should be checked for the given node
*/
function shouldCheck(nodeType, destructuringType) {
return normalizedOptions &&
normalizedOptions[nodeType] &&
normalizedOptions[nodeType][destructuringType];
}
/**
* Determines if the given node is accessing an array index
* *
* This is used to differentiate array index access from object property * This is used to differentiate array index access from object property
* access. * access.
@ -110,22 +148,22 @@ module.exports = {
} }
if (isArrayIndexAccess(rightNode)) { if (isArrayIndexAccess(rightNode)) {
if (checkArrays) { if (shouldCheck(reportNode.type, "array")) {
report(reportNode, "array"); report(reportNode, "array");
} }
return; return;
} }
if (checkObjects && enforceForRenamedProperties) { if (shouldCheck(reportNode.type, "object") && enforceForRenamedProperties) {
report(reportNode, "object"); report(reportNode, "object");
return; return;
} }
if (checkObjects) { if (shouldCheck(reportNode.type, "object")) {
const property = rightNode.property; const property = rightNode.property;
if ((property.type === "Literal" && leftNode.name === property.value) || if ((property.type === "Literal" && leftNode.name === property.value) || (property.type === "Identifier" &&
(property.type === "Identifier" && leftNode.name === property.name)) { leftNode.name === property.name)) {
report(reportNode, "object"); report(reportNode, "object");
} }
} }

43
tools/eslint/lib/rules/prefer-numeric-literals.js

@ -5,6 +5,33 @@
"use strict"; "use strict";
//------------------------------------------------------------------------------
// Helpers
//------------------------------------------------------------------------------
/**
* Checks to see if a CallExpression's callee node is `parseInt` or
* `Number.parseInt`.
* @param {ASTNode} calleeNode The callee node to evaluate.
* @returns {boolean} True if the callee is `parseInt` or `Number.parseInt`,
* false otherwise.
*/
function isParseInt(calleeNode) {
switch (calleeNode.type) {
case "Identifier":
return calleeNode.name === "parseInt";
case "MemberExpression":
return calleeNode.object.type === "Identifier" &&
calleeNode.object.name === "Number" &&
calleeNode.property.type === "Identifier" &&
calleeNode.property.name === "parseInt";
// no default
}
return false;
}
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
// Rule Definition // Rule Definition
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
@ -12,7 +39,7 @@
module.exports = { module.exports = {
meta: { meta: {
docs: { docs: {
description: "disallow `parseInt()` in favor of binary, octal, and hexadecimal literals", description: "disallow `parseInt()` and `Number.parseInt()` in favor of binary, octal, and hexadecimal literals",
category: "ECMAScript 6", category: "ECMAScript 6",
recommended: false recommended: false
}, },
@ -23,6 +50,8 @@ module.exports = {
}, },
create(context) { create(context) {
const sourceCode = context.getSourceCode();
const radixMap = { const radixMap = {
2: "binary", 2: "binary",
8: "octal", 8: "octal",
@ -35,9 +64,9 @@ module.exports = {
16: "0x" 16: "0x"
}; };
//-------------------------------------------------------------------------- //----------------------------------------------------------------------
// Public // Public
//-------------------------------------------------------------------------- //----------------------------------------------------------------------
return { return {
@ -51,16 +80,16 @@ module.exports = {
// only error if the radix is 2, 8, or 16 // only error if the radix is 2, 8, or 16
const radixName = radixMap[node.arguments[1].value]; const radixName = radixMap[node.arguments[1].value];
if (node.callee.type === "Identifier" && if (isParseInt(node.callee) &&
node.callee.name === "parseInt" &&
radixName && radixName &&
node.arguments[0].type === "Literal" node.arguments[0].type === "Literal"
) { ) {
context.report({ context.report({
node, node,
message: "Use {{radixName}} literals instead of parseInt().", message: "Use {{radixName}} literals instead of {{functionName}}().",
data: { data: {
radixName radixName,
functionName: sourceCode.getText(node.callee)
}, },
fix(fixer) { fix(fixer) {
const newPrefix = prefixMap[node.arguments[1].value]; const newPrefix = prefixMap[node.arguments[1].value];

17
tools/eslint/lib/util/npm-util.js

@ -10,7 +10,7 @@
//------------------------------------------------------------------------------ //------------------------------------------------------------------------------
const fs = require("fs"), const fs = require("fs"),
childProcess = require("child_process"), spawn = require("cross-spawn"),
path = require("path"), path = require("path"),
log = require("../logging"); log = require("../logging");
@ -50,22 +50,23 @@ function findPackageJson(startDir) {
* @returns {void} * @returns {void}
*/ */
function installSyncSaveDev(packages) { function installSyncSaveDev(packages) {
if (Array.isArray(packages)) { if (!Array.isArray(packages)) {
packages = packages.join(" "); packages = [packages];
} }
childProcess.execSync(`npm i --save-dev ${packages}`, { stdio: "inherit", encoding: "utf8" }); spawn.sync("npm", ["i", "--save-dev"].concat(packages), { stdio: "inherit" });
} }
/** /**
* Fetch `peerDependencies` of the given package by `npm show` command. * Fetch `peerDependencies` of the given package by `npm show` command.
* @param {string} packageName The package name to fetch peerDependencies. * @param {string} packageName The package name to fetch peerDependencies.
* @returns {string[]} Gotten peerDependencies. * @returns {Object} Gotten peerDependencies.
*/ */
function fetchPeerDependencies(packageName) { function fetchPeerDependencies(packageName) {
const fetchedText = childProcess.execSync( const fetchedText = spawn.sync(
`npm show --json ${packageName} peerDependencies`, "npm",
["show", "--json", packageName, "peerDependencies"],
{ encoding: "utf8" } { encoding: "utf8" }
).trim(); ).stdout.trim();
return JSON.parse(fetchedText || "{}"); return JSON.parse(fetchedText || "{}");
} }

8
tools/eslint/node_modules/ajv/dist/ajv.bundle.js

@ -574,7 +574,9 @@ function compile(schema, root, localRefs, baseId) {
} }
} }
if (v !== undefined) { if (v === undefined) {
removeLocalRef(ref);
} else {
replaceLocalRef(ref, v); replaceLocalRef(ref, v);
return resolvedRef(v, refCode); return resolvedRef(v, refCode);
} }
@ -587,6 +589,10 @@ function compile(schema, root, localRefs, baseId) {
return 'refVal' + refId; return 'refVal' + refId;
} }
function removeLocalRef(ref) {
delete refs[ref];
}
function replaceLocalRef(ref, v) { function replaceLocalRef(ref, v) {
var refId = refs[ref]; var refId = refs[ref];
refVal[refId] = v; refVal[refId] = v;

4
tools/eslint/node_modules/ajv/dist/ajv.min.js

File diff suppressed because one or more lines are too long

2
tools/eslint/node_modules/ajv/dist/ajv.min.js.map

File diff suppressed because one or more lines are too long

8
tools/eslint/node_modules/ajv/lib/compile/index.js

@ -196,7 +196,9 @@ function compile(schema, root, localRefs, baseId) {
} }
} }
if (v !== undefined) { if (v === undefined) {
removeLocalRef(ref);
} else {
replaceLocalRef(ref, v); replaceLocalRef(ref, v);
return resolvedRef(v, refCode); return resolvedRef(v, refCode);
} }
@ -209,6 +211,10 @@ function compile(schema, root, localRefs, baseId) {
return 'refVal' + refId; return 'refVal' + refId;
} }
function removeLocalRef(ref) {
delete refs[ref];
}
function replaceLocalRef(ref, v) { function replaceLocalRef(ref, v) {
var refId = refs[ref]; var refId = refs[ref];
refVal[refId] = v; refVal[refId] = v;

10
tools/eslint/node_modules/ajv/package.json

@ -1,8 +1,8 @@
{ {
"_from": "ajv@^5.2.0", "_from": "ajv@^5.2.0",
"_id": "ajv@5.2.1", "_id": "ajv@5.2.2",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-3NAwRRdYg7obY25a6ew9+auFMjo=", "_integrity": "sha1-R8aNaehvXZUxA7AHSpQw3GPaXjk=",
"_location": "/eslint/ajv", "_location": "/eslint/ajv",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -18,8 +18,8 @@
"_requiredBy": [ "_requiredBy": [
"/eslint" "/eslint"
], ],
"_resolved": "https://registry.npmjs.org/ajv/-/ajv-5.2.1.tgz", "_resolved": "https://registry.npmjs.org/ajv/-/ajv-5.2.2.tgz",
"_shasum": "dcd03045175883ba1b636e5ae9ec3df9ab85323a", "_shasum": "47c68d69e86f5d953103b0074a9430dc63da5e39",
"_spec": "ajv@^5.2.0", "_spec": "ajv@^5.2.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint",
"author": { "author": {
@ -126,5 +126,5 @@
}, },
"tonicExampleFilename": ".tonic_example.js", "tonicExampleFilename": ".tonic_example.js",
"typings": "lib/ajv.d.ts", "typings": "lib/ajv.d.ts",
"version": "5.2.1" "version": "5.2.2"
} }

32
tools/eslint/node_modules/character-entities-legacy/package.json

@ -1,8 +1,8 @@
{ {
"_from": "character-entities-legacy@^1.0.0", "_from": "character-entities-legacy@^1.0.0",
"_id": "character-entities-legacy@1.1.0", "_id": "character-entities-legacy@1.1.1",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-sYqtmPa3vMZGweTIH58ZVjdqVho=", "_integrity": "sha1-9Ad53xoQGHK7UQo9KV4fzPFHIC8=",
"_location": "/character-entities-legacy", "_location": "/character-entities-legacy",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -18,8 +18,8 @@
"_requiredBy": [ "_requiredBy": [
"/parse-entities" "/parse-entities"
], ],
"_resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.0.tgz", "_resolved": "https://registry.npmjs.org/character-entities-legacy/-/character-entities-legacy-1.1.1.tgz",
"_shasum": "b18aad98f6b7bcc646c1e4c81f9f1956376a561a", "_shasum": "f40779df1a101872bb510a3d295e1fccf147202f",
"_spec": "character-entities-legacy@^1.0.0", "_spec": "character-entities-legacy@^1.0.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/parse-entities", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/parse-entities",
"author": { "author": {
@ -43,14 +43,13 @@
"description": "HTML legacy character entity information", "description": "HTML legacy character entity information",
"devDependencies": { "devDependencies": {
"bail": "^1.0.1", "bail": "^1.0.1",
"browserify": "^13.0.1", "browserify": "^14.0.0",
"concat-stream": "^1.5.2", "concat-stream": "^1.5.2",
"esmangle": "^1.0.1", "esmangle": "^1.0.1",
"nyc": "^8.0.0", "remark-cli": "^3.0.0",
"remark-cli": "^2.0.0", "remark-preset-wooorm": "^3.0.0",
"remark-preset-wooorm": "^1.0.0",
"tape": "^4.0.0", "tape": "^4.0.0",
"xo": "^0.17.0" "xo": "^0.18.0"
}, },
"files": [ "files": [
"index.json" "index.json"
@ -69,8 +68,9 @@
"main": "index.json", "main": "index.json",
"name": "character-entities-legacy", "name": "character-entities-legacy",
"remarkConfig": { "remarkConfig": {
"output": true, "plugins": [
"presets": "wooorm" "preset-wooorm"
]
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -81,15 +81,15 @@
"build-bundle": "browserify index.json --bare -s characterEntitiesLegacy > character-entities-legacy.js", "build-bundle": "browserify index.json --bare -s characterEntitiesLegacy > character-entities-legacy.js",
"build-generate": "node build", "build-generate": "node build",
"build-mangle": "esmangle character-entities-legacy.js > character-entities-legacy.min.js", "build-mangle": "esmangle character-entities-legacy.js > character-entities-legacy.min.js",
"build-md": "remark . --quiet --frail", "build-md": "remark . -qfo",
"lint": "xo", "lint": "xo",
"test": "npm run build && npm run lint && npm run test-coverage", "test": "npm run build && npm run lint && npm run test-api",
"test-api": "node test", "test-api": "node test"
"test-coverage": "nyc --reporter lcov tape test.js"
}, },
"version": "1.1.0", "version": "1.1.1",
"xo": { "xo": {
"space": true, "space": true,
"esnext": false,
"ignores": [ "ignores": [
"character-entities-legacy.js" "character-entities-legacy.js"
] ]

27
tools/eslint/node_modules/character-entities-legacy/readme.md

@ -1,4 +1,4 @@
# character-entities-legacy [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] # character-entities-legacy [![Build Status][travis-badge]][travis]
HTML legacy character entity information: for legacy reasons some HTML legacy character entity information: for legacy reasons some
character entities are not required to have a trailing semicolon: character entities are not required to have a trailing semicolon:
@ -6,7 +6,7 @@ character entities are not required to have a trailing semicolon:
## Installation ## Installation
[npm][npm-install]: [npm][]:
```bash ```bash
npm install character-entities-legacy npm install character-entities-legacy
@ -15,9 +15,9 @@ npm install character-entities-legacy
## Usage ## Usage
```js ```js
console.log(characterEntitiesLegacy.copy); // © console.log(characterEntitiesLegacy.copy); //=> '©'
console.log(characterEntitiesLegacy.frac34); // ¾ console.log(characterEntitiesLegacy.frac34); //=> '¾'
console.log(characterEntitiesLegacy.sup1); // ¹ console.log(characterEntitiesLegacy.sup1); //=> '¹'
``` ```
## API ## API
@ -31,6 +31,17 @@ replacements.
See [whatwg/html][html]. See [whatwg/html][html].
## Related
* [`character-entities`](https://github.com/wooorm/character-entities)
— HTML character entity info
* [`character-entities-html4`](https://github.com/wooorm/character-entities-html4)
— HTML 4 character entity info
* [`parse-entities`](https://github.com/wooorm/parse-entities)
— Parse HTML character references
* [`stringify-entities`](https://github.com/wooorm/stringify-entities)
— Stringify HTML character references
## License ## License
[MIT][license] © [Titus Wormer][author] [MIT][license] © [Titus Wormer][author]
@ -41,11 +52,7 @@ See [whatwg/html][html].
[travis]: https://travis-ci.org/wooorm/character-entities-legacy [travis]: https://travis-ci.org/wooorm/character-entities-legacy
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/character-entities-legacy.svg [npm]: https://docs.npmjs.com/cli/install
[codecov]: https://codecov.io/github/wooorm/character-entities-legacy
[npm-install]: https://docs.npmjs.com/cli/install
[license]: LICENSE [license]: LICENSE

32
tools/eslint/node_modules/character-entities/package.json

@ -1,8 +1,8 @@
{ {
"_from": "character-entities@^1.0.0", "_from": "character-entities@^1.0.0",
"_id": "character-entities@1.2.0", "_id": "character-entities@1.2.1",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-poPiz3Xb6LFxljUxNk5Y4YobFV8=", "_integrity": "sha1-92hxvl72bdt/j440eOzDdMJ9bco=",
"_location": "/character-entities", "_location": "/character-entities",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -18,8 +18,8 @@
"_requiredBy": [ "_requiredBy": [
"/parse-entities" "/parse-entities"
], ],
"_resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.0.tgz", "_resolved": "https://registry.npmjs.org/character-entities/-/character-entities-1.2.1.tgz",
"_shasum": "a683e2cf75dbe8b171963531364e58e18a1b155f", "_shasum": "f76871be5ef66ddb7f8f8e3478ecc374c27d6dca",
"_spec": "character-entities@^1.0.0", "_spec": "character-entities@^1.0.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/parse-entities", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/parse-entities",
"author": { "author": {
@ -43,14 +43,13 @@
"description": "HTML character entity information", "description": "HTML character entity information",
"devDependencies": { "devDependencies": {
"bail": "^1.0.1", "bail": "^1.0.1",
"browserify": "^13.0.1", "browserify": "^14.0.0",
"concat-stream": "^1.5.2", "concat-stream": "^1.5.2",
"esmangle": "^1.0.1", "esmangle": "^1.0.1",
"nyc": "^8.0.0", "remark-cli": "^3.0.0",
"remark-cli": "^2.0.0", "remark-preset-wooorm": "^3.0.0",
"remark-preset-wooorm": "^1.0.0",
"tape": "^4.0.0", "tape": "^4.0.0",
"xo": "^0.17.0" "xo": "^0.18.0"
}, },
"files": [ "files": [
"index.json" "index.json"
@ -69,8 +68,9 @@
"main": "index.json", "main": "index.json",
"name": "character-entities", "name": "character-entities",
"remarkConfig": { "remarkConfig": {
"output": true, "plugins": [
"presets": "wooorm" "preset-wooorm"
]
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -81,15 +81,15 @@
"build-bundle": "browserify index.json --bare -s characterEntities > character-entities.js", "build-bundle": "browserify index.json --bare -s characterEntities > character-entities.js",
"build-generate": "node build", "build-generate": "node build",
"build-mangle": "esmangle character-entities.js > character-entities.min.js", "build-mangle": "esmangle character-entities.js > character-entities.min.js",
"build-md": "remark . --quiet --frail", "build-md": "remark . -qfo",
"lint": "xo", "lint": "xo",
"test": "npm run build && npm run lint && npm run test-coverage", "test": "npm run build && npm run lint && npm run test-api",
"test-api": "node test", "test-api": "node test"
"test-coverage": "nyc --reporter lcov tape test.js"
}, },
"version": "1.2.0", "version": "1.2.1",
"xo": { "xo": {
"space": true, "space": true,
"esnext": false,
"ignores": [ "ignores": [
"character-entities.js" "character-entities.js"
] ]

29
tools/eslint/node_modules/character-entities/readme.md

@ -1,12 +1,10 @@
# character-entities [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] # character-entities [![Build Status][travis-badge]][travis]
<!--lint disable heading-increment list-item-spacing no-duplicate-headings-->
HTML character entity information. HTML character entity information.
## Installation ## Installation
[npm][npm-install]: [npm][]:
```bash ```bash
npm install character-entities npm install character-entities
@ -15,9 +13,9 @@ npm install character-entities
## Usage ## Usage
```js ```js
console.log(characterEntities.AElig); // Æ console.log(characterEntities.AElig); //=> 'Æ'
console.log(characterEntities.aelig); // æ console.log(characterEntities.aelig); //=> 'æ'
console.log(characterEntities.amp); // & console.log(characterEntities.amp); //=> '&'
``` ```
## API ## API
@ -30,6 +28,17 @@ Mapping between (case-sensitive) character entity names to replacements.
See [html.spec.whatwg.org][html]. See [html.spec.whatwg.org][html].
## Related
* [`character-entities-html4`](https://github.com/wooorm/character-entities-html4)
— HTML 4 character entity info
* [`character-entities-legacy`](https://github.com/wooorm/character-entities-legacy)
— Legacy character entity info
* [`parse-entities`](https://github.com/wooorm/parse-entities)
— Parse HTML character references
* [`stringify-entities`](https://github.com/wooorm/stringify-entities)
— Stringify HTML character references
## License ## License
[MIT][license] © [Titus Wormer][author] [MIT][license] © [Titus Wormer][author]
@ -40,11 +49,7 @@ See [html.spec.whatwg.org][html].
[travis]: https://travis-ci.org/wooorm/character-entities [travis]: https://travis-ci.org/wooorm/character-entities
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/character-entities.svg [npm]: https://docs.npmjs.com/cli/install
[codecov]: https://codecov.io/github/wooorm/character-entities
[npm-install]: https://docs.npmjs.com/cli/install
[license]: LICENSE [license]: LICENSE

40
tools/eslint/node_modules/character-reference-invalid/package.json

@ -1,8 +1,8 @@
{ {
"_from": "character-reference-invalid@^1.0.0", "_from": "character-reference-invalid@^1.0.0",
"_id": "character-reference-invalid@1.1.0", "_id": "character-reference-invalid@1.1.1",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-3smtHfufjQa0/NqircPE/ZevHmg=", "_integrity": "sha1-lCg191Dk7GGjCOYMLvjMEBEgLvw=",
"_location": "/character-reference-invalid", "_location": "/character-reference-invalid",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -18,8 +18,8 @@
"_requiredBy": [ "_requiredBy": [
"/parse-entities" "/parse-entities"
], ],
"_resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.0.tgz", "_resolved": "https://registry.npmjs.org/character-reference-invalid/-/character-reference-invalid-1.1.1.tgz",
"_shasum": "dec9ad1dfb9f8d06b4fcdaa2adc3c4fd97af1e68", "_shasum": "942835f750e4ec61a308e60c2ef8cc1011202efc",
"_spec": "character-reference-invalid@^1.0.0", "_spec": "character-reference-invalid@^1.0.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/parse-entities", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/parse-entities",
"author": { "author": {
@ -43,14 +43,17 @@
"description": "HTML invalid numeric character reference information", "description": "HTML invalid numeric character reference information",
"devDependencies": { "devDependencies": {
"bail": "^1.0.1", "bail": "^1.0.1",
"browserify": "^13.0.1", "browserify": "^14.0.0",
"concat-stream": "^1.6.0",
"esmangle": "^1.0.1", "esmangle": "^1.0.1",
"jsdom": "^9.4.1", "hast-util-select": "^1.0.1",
"nyc": "^8.0.0", "hast-util-to-string": "^1.0.0",
"remark-cli": "^2.0.0", "rehype-parse": "^4.0.0",
"remark-preset-wooorm": "^1.0.0", "remark-cli": "^3.0.0",
"remark-preset-wooorm": "^3.0.0",
"tape": "^4.0.0", "tape": "^4.0.0",
"xo": "^0.17.0" "unified": "^6.1.5",
"xo": "^0.18.0"
}, },
"files": [ "files": [
"index.json" "index.json"
@ -70,27 +73,28 @@
"main": "index.json", "main": "index.json",
"name": "character-reference-invalid", "name": "character-reference-invalid",
"remarkConfig": { "remarkConfig": {
"output": true, "plugins": [
"presets": "wooorm" "preset-wooorm"
]
}, },
"repository": { "repository": {
"type": "git", "type": "git",
"url": "git+https://github.com/wooorm/character-reference-invalid.git" "url": "git+https://github.com/wooorm/character-reference-invalid.git"
}, },
"scripts": { "scripts": {
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", "build": "npm run build-generate && npm run build-md && npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.json --bare -s characterReferenceInvalid > character-reference-invalid.js", "build-bundle": "browserify index.json --bare -s characterReferenceInvalid > character-reference-invalid.js",
"build-generate": "node build", "build-generate": "node build",
"build-mangle": "esmangle character-reference-invalid.js > character-reference-invalid.min.js", "build-mangle": "esmangle character-reference-invalid.js > character-reference-invalid.min.js",
"build-md": "remark . --quiet --frail", "build-md": "remark . -qfo",
"lint": "xo", "lint": "xo",
"test": "npm run build && npm run lint && npm run test-coverage", "test": "npm run build && npm run lint && npm run test-api",
"test-api": "node test", "test-api": "node test"
"test-coverage": "nyc --reporter lcov tape test.js"
}, },
"version": "1.1.0", "version": "1.1.1",
"xo": { "xo": {
"space": true, "space": true,
"esnext": false,
"rules": { "rules": {
"guard-for-in": "off" "guard-for-in": "off"
}, },

29
tools/eslint/node_modules/character-reference-invalid/readme.md

@ -1,10 +1,10 @@
# character-reference-invalid [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] # character-reference-invalid [![Build Status][travis-badge]][travis]
HTML invalid numeric character reference information. HTML invalid numeric character reference information.
## Installation ## Installation
[npm][npm-install]: [npm][]:
```bash ```bash
npm install character-reference-invalid npm install character-reference-invalid
@ -13,9 +13,9 @@ npm install character-reference-invalid
## Usage ## Usage
```js ```js
console.log(characterReferenceInvalid[0x80]); // € console.log(characterReferenceInvalid[0x80]); //=> ''
console.log(characterReferenceInvalid[0x89]); // ‰ console.log(characterReferenceInvalid[0x89]); //=> ''
console.log(characterReferenceInvalid[0x99]); // ™ console.log(characterReferenceInvalid[0x99]); //=> ''
``` ```
## API ## API
@ -28,6 +28,19 @@ Mapping between invalid numeric character reference to replacements.
See [html.spec.whatwg.org][html]. See [html.spec.whatwg.org][html].
## Related
* [`character-entities`](https://github.com/wooorm/character-entities)
— HTML character entity info
* [`character-entities-html4`](https://github.com/wooorm/character-entities-html4)
— HTML 4 character entity info
* [`character-entities-legacy`](https://github.com/wooorm/character-entities-legacy)
— Legacy character entity info
* [`parse-entities`](https://github.com/wooorm/parse-entities)
— Parse HTML character references
* [`stringify-entities`](https://github.com/wooorm/stringify-entities)
— Stringify HTML character references
## License ## License
[MIT][license] © [Titus Wormer][author] [MIT][license] © [Titus Wormer][author]
@ -38,11 +51,7 @@ See [html.spec.whatwg.org][html].
[travis]: https://travis-ci.org/wooorm/character-reference-invalid [travis]: https://travis-ci.org/wooorm/character-reference-invalid
[codecov-badge]: https://img.shields.io/codecov/c/github/wooorm/character-reference-invalid.svg [npm]: https://docs.npmjs.com/cli/install
[codecov]: https://codecov.io/github/wooorm/character-reference-invalid
[npm-install]: https://docs.npmjs.com/cli/install
[license]: LICENSE [license]: LICENSE

43
tools/eslint/node_modules/color-name/.eslintrc.json

@ -0,0 +1,43 @@
{
"env": {
"browser": true,
"node": true,
"commonjs": true,
"es6": true
},
"extends": "eslint:recommended",
"rules": {
"strict": 2,
"indent": 0,
"linebreak-style": 0,
"quotes": 0,
"semi": 0,
"no-cond-assign": 1,
"no-constant-condition": 1,
"no-duplicate-case": 1,
"no-empty": 1,
"no-ex-assign": 1,
"no-extra-boolean-cast": 1,
"no-extra-semi": 1,
"no-fallthrough": 1,
"no-func-assign": 1,
"no-global-assign": 1,
"no-implicit-globals": 2,
"no-inner-declarations": ["error", "functions"],
"no-irregular-whitespace": 2,
"no-loop-func": 1,
"no-multi-str": 1,
"no-mixed-spaces-and-tabs": 1,
"no-proto": 1,
"no-sequences": 1,
"no-throw-literal": 1,
"no-unmodified-loop-condition": 1,
"no-useless-call": 1,
"no-void": 1,
"no-with": 2,
"wrap-iife": 1,
"no-redeclare": 1,
"no-unused-vars": ["error", { "vars": "all", "args": "none" }],
"no-sparse-arrays": 1
}
}

2
tools/eslint/node_modules/color-name/index.js

@ -1,3 +1,5 @@
'use strict'
module.exports = { module.exports = {
"aliceblue": [240, 248, 255], "aliceblue": [240, 248, 255],
"antiquewhite": [250, 235, 215], "antiquewhite": [250, 235, 215],

13
tools/eslint/node_modules/color-name/package.json

@ -1,8 +1,8 @@
{ {
"_from": "color-name@^1.1.1", "_from": "color-name@^1.1.1",
"_id": "color-name@1.1.2", "_id": "color-name@1.1.3",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-XIq3K2S9IhXWF66VWeuxSEdc+Y0=", "_integrity": "sha1-p9BVi9icQveV3UIyj3QIMcpTvCU=",
"_location": "/eslint/color-name", "_location": "/eslint/color-name",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -18,8 +18,8 @@
"_requiredBy": [ "_requiredBy": [
"/eslint/color-convert" "/eslint/color-convert"
], ],
"_resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.2.tgz", "_resolved": "https://registry.npmjs.org/color-name/-/color-name-1.1.3.tgz",
"_shasum": "5c8ab72b64bd2215d617ae9559ebb148475cf98d", "_shasum": "a7d0558bd89c42f795dd42328f740831ca53bc25",
"_spec": "color-name@^1.1.1", "_spec": "color-name@^1.1.1",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/color-convert", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/color-convert",
"author": { "author": {
@ -32,9 +32,6 @@
"bundleDependencies": false, "bundleDependencies": false,
"deprecated": false, "deprecated": false,
"description": "A list of color names and its values", "description": "A list of color names and its values",
"files": [
"index.js"
],
"homepage": "https://github.com/dfcreative/color-name", "homepage": "https://github.com/dfcreative/color-name",
"keywords": [ "keywords": [
"color-name", "color-name",
@ -52,5 +49,5 @@
"scripts": { "scripts": {
"test": "node test.js" "test": "node test.js"
}, },
"version": "1.1.2" "version": "1.1.3"
} }

19
tools/eslint/node_modules/cross-spawn/LICENSE

@ -0,0 +1,19 @@
Copyright (c) 2014 IndigoUnited
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is furnished
to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in all
copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

85
tools/eslint/node_modules/cross-spawn/README.md

@ -0,0 +1,85 @@
# cross-spawn
[![NPM version][npm-image]][npm-url] [![Downloads][downloads-image]][npm-url] [![Build Status][travis-image]][travis-url] [![Build status][appveyor-image]][appveyor-url] [![Dependency status][david-dm-image]][david-dm-url] [![Dev Dependency status][david-dm-dev-image]][david-dm-dev-url]
[npm-url]:https://npmjs.org/package/cross-spawn
[downloads-image]:http://img.shields.io/npm/dm/cross-spawn.svg
[npm-image]:http://img.shields.io/npm/v/cross-spawn.svg
[travis-url]:https://travis-ci.org/IndigoUnited/node-cross-spawn
[travis-image]:http://img.shields.io/travis/IndigoUnited/node-cross-spawn/master.svg
[appveyor-url]:https://ci.appveyor.com/project/satazor/node-cross-spawn
[appveyor-image]:https://img.shields.io/appveyor/ci/satazor/node-cross-spawn/master.svg
[david-dm-url]:https://david-dm.org/IndigoUnited/node-cross-spawn
[david-dm-image]:https://img.shields.io/david/IndigoUnited/node-cross-spawn.svg
[david-dm-dev-url]:https://david-dm.org/IndigoUnited/node-cross-spawn#info=devDependencies
[david-dm-dev-image]:https://img.shields.io/david/dev/IndigoUnited/node-cross-spawn.svg
A cross platform solution to node's spawn and spawnSync.
## Installation
`$ npm install cross-spawn`
If you are using `spawnSync` on node 0.10 or older, you will also need to install `spawn-sync`:
`$ npm install spawn-sync`
## Why
Node has issues when using spawn on Windows:
- It ignores [PATHEXT](https://github.com/joyent/node/issues/2318)
- It does not support [shebangs](http://pt.wikipedia.org/wiki/Shebang)
- No `options.shell` support on node < v6
- It does not allow you to run `del` or `dir`
All these issues are handled correctly by `cross-spawn`.
There are some known modules, such as [win-spawn](https://github.com/ForbesLindesay/win-spawn), that try to solve this but they are either broken or provide faulty escaping of shell arguments.
## Usage
Exactly the same way as node's [`spawn`](https://nodejs.org/api/child_process.html#child_process_child_process_spawn_command_args_options) or [`spawnSync`](https://nodejs.org/api/child_process.html#child_process_child_process_spawnsync_command_args_options), so it's a drop in replacement.
```js
var spawn = require('cross-spawn');
// Spawn NPM asynchronously
var child = spawn('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
// Spawn NPM synchronously
var results = spawn.sync('npm', ['list', '-g', '-depth', '0'], { stdio: 'inherit' });
```
## Caveats
#### `options.shell` as an alternative to `cross-spawn`
Starting from node v6, `spawn` has a `shell` option that allows you run commands from within a shell. This new option solves most of the problems that `cross-spawn` attempts to solve, but:
- It's not supported in node < v6
- It has no support for shebangs on Windows
- You must manually escape the command and arguments which is very error prone, specially when passing user input
If you are using the `shell` option to spawn a command in a cross platform way, consider using `cross-spawn` instead. You have been warned.
#### Shebangs
While `cross-spawn` handles shebangs on Windows, its support is limited: e.g.: it doesn't handle arguments after the path, e.g.: `#!/bin/bash -e`.
Remember to always test your code on Windows!
## Tests
`$ npm test`
## License
Released under the [MIT License](http://www.opensource.org/licenses/mit-license.php).

59
tools/eslint/node_modules/cross-spawn/index.js

@ -0,0 +1,59 @@
'use strict';
var cp = require('child_process');
var parse = require('./lib/parse');
var enoent = require('./lib/enoent');
var cpSpawnSync = cp.spawnSync;
function spawn(command, args, options) {
var parsed;
var spawned;
// Parse the arguments
parsed = parse(command, args, options);
// Spawn the child process
spawned = cp.spawn(parsed.command, parsed.args, parsed.options);
// Hook into child process "exit" event to emit an error if the command
// does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
enoent.hookChildProcess(spawned, parsed);
return spawned;
}
function spawnSync(command, args, options) {
var parsed;
var result;
if (!cpSpawnSync) {
try {
cpSpawnSync = require('spawn-sync'); // eslint-disable-line global-require
} catch (ex) {
throw new Error(
'In order to use spawnSync on node 0.10 or older, you must ' +
'install spawn-sync:\n\n' +
' npm install spawn-sync --save'
);
}
}
// Parse the arguments
parsed = parse(command, args, options);
// Spawn the child process
result = cpSpawnSync(parsed.command, parsed.args, parsed.options);
// Analyze if the command does not exists, see: https://github.com/IndigoUnited/node-cross-spawn/issues/16
result.error = result.error || enoent.verifyENOENTSync(result.status, parsed);
return result;
}
module.exports = spawn;
module.exports.spawn = spawn;
module.exports.sync = spawnSync;
module.exports._parse = parse;
module.exports._enoent = enoent;

73
tools/eslint/node_modules/cross-spawn/lib/enoent.js

@ -0,0 +1,73 @@
'use strict';
var isWin = process.platform === 'win32';
var resolveCommand = require('./util/resolveCommand');
var isNode10 = process.version.indexOf('v0.10.') === 0;
function notFoundError(command, syscall) {
var err;
err = new Error(syscall + ' ' + command + ' ENOENT');
err.code = err.errno = 'ENOENT';
err.syscall = syscall + ' ' + command;
return err;
}
function hookChildProcess(cp, parsed) {
var originalEmit;
if (!isWin) {
return;
}
originalEmit = cp.emit;
cp.emit = function (name, arg1) {
var err;
// If emitting "exit" event and exit code is 1, we need to check if
// the command exists and emit an "error" instead
// See: https://github.com/IndigoUnited/node-cross-spawn/issues/16
if (name === 'exit') {
err = verifyENOENT(arg1, parsed, 'spawn');
if (err) {
return originalEmit.call(cp, 'error', err);
}
}
return originalEmit.apply(cp, arguments);
};
}
function verifyENOENT(status, parsed) {
if (isWin && status === 1 && !parsed.file) {
return notFoundError(parsed.original, 'spawn');
}
return null;
}
function verifyENOENTSync(status, parsed) {
if (isWin && status === 1 && !parsed.file) {
return notFoundError(parsed.original, 'spawnSync');
}
// If we are in node 10, then we are using spawn-sync; if it exited
// with -1 it probably means that the command does not exist
if (isNode10 && status === -1) {
parsed.file = isWin ? parsed.file : resolveCommand(parsed.original);
if (!parsed.file) {
return notFoundError(parsed.original, 'spawnSync');
}
}
return null;
}
module.exports.hookChildProcess = hookChildProcess;
module.exports.verifyENOENT = verifyENOENT;
module.exports.verifyENOENTSync = verifyENOENTSync;
module.exports.notFoundError = notFoundError;

113
tools/eslint/node_modules/cross-spawn/lib/parse.js

@ -0,0 +1,113 @@
'use strict';
var resolveCommand = require('./util/resolveCommand');
var hasEmptyArgumentBug = require('./util/hasEmptyArgumentBug');
var escapeArgument = require('./util/escapeArgument');
var escapeCommand = require('./util/escapeCommand');
var readShebang = require('./util/readShebang');
var isWin = process.platform === 'win32';
var skipShellRegExp = /\.(?:com|exe)$/i;
// Supported in Node >= 6 and >= 4.8
var supportsShellOption = parseInt(process.version.substr(1).split('.')[0], 10) >= 6 ||
parseInt(process.version.substr(1).split('.')[0], 10) === 4 && parseInt(process.version.substr(1).split('.')[1], 10) >= 8;
function parseNonShell(parsed) {
var shebang;
var needsShell;
var applyQuotes;
if (!isWin) {
return parsed;
}
// Detect & add support for shebangs
parsed.file = resolveCommand(parsed.command);
parsed.file = parsed.file || resolveCommand(parsed.command, true);
shebang = parsed.file && readShebang(parsed.file);
if (shebang) {
parsed.args.unshift(parsed.file);
parsed.command = shebang;
needsShell = hasEmptyArgumentBug || !skipShellRegExp.test(resolveCommand(shebang) || resolveCommand(shebang, true));
} else {
needsShell = hasEmptyArgumentBug || !skipShellRegExp.test(parsed.file);
}
// If a shell is required, use cmd.exe and take care of escaping everything correctly
if (needsShell) {
// Escape command & arguments
applyQuotes = (parsed.command !== 'echo'); // Do not quote arguments for the special "echo" command
parsed.command = escapeCommand(parsed.command);
parsed.args = parsed.args.map(function (arg) {
return escapeArgument(arg, applyQuotes);
});
// Make use of cmd.exe
parsed.args = ['/d', '/s', '/c', '"' + parsed.command + (parsed.args.length ? ' ' + parsed.args.join(' ') : '') + '"'];
parsed.command = process.env.comspec || 'cmd.exe';
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
}
return parsed;
}
function parseShell(parsed) {
var shellCommand;
// If node supports the shell option, there's no need to mimic its behavior
if (supportsShellOption) {
return parsed;
}
// Mimic node shell option, see: https://github.com/nodejs/node/blob/b9f6a2dc059a1062776133f3d4fd848c4da7d150/lib/child_process.js#L335
shellCommand = [parsed.command].concat(parsed.args).join(' ');
if (isWin) {
parsed.command = typeof parsed.options.shell === 'string' ? parsed.options.shell : process.env.comspec || 'cmd.exe';
parsed.args = ['/d', '/s', '/c', '"' + shellCommand + '"'];
parsed.options.windowsVerbatimArguments = true; // Tell node's spawn that the arguments are already escaped
} else {
if (typeof parsed.options.shell === 'string') {
parsed.command = parsed.options.shell;
} else if (process.platform === 'android') {
parsed.command = '/system/bin/sh';
} else {
parsed.command = '/bin/sh';
}
parsed.args = ['-c', shellCommand];
}
return parsed;
}
// ------------------------------------------------
function parse(command, args, options) {
var parsed;
// Normalize arguments, similar to nodejs
if (args && !Array.isArray(args)) {
options = args;
args = null;
}
args = args ? args.slice(0) : []; // Clone array to avoid changing the original
options = options || {};
// Build our parsed object
parsed = {
command: command,
args: args,
options: options,
file: undefined,
original: command,
};
// Delegate further parsing to shell or non-shell
return options.shell ? parseShell(parsed) : parseNonShell(parsed);
}
module.exports = parse;

30
tools/eslint/node_modules/cross-spawn/lib/util/escapeArgument.js

@ -0,0 +1,30 @@
'use strict';
function escapeArgument(arg, quote) {
// Convert to string
arg = '' + arg;
// If we are not going to quote the argument,
// escape shell metacharacters, including double and single quotes:
if (!quote) {
arg = arg.replace(/([()%!^<>&|;,"'\s])/g, '^$1');
} else {
// Sequence of backslashes followed by a double quote:
// double up all the backslashes and escape the double quote
arg = arg.replace(/(\\*)"/g, '$1$1\\"');
// Sequence of backslashes followed by the end of the string
// (which will become a double quote later):
// double up all the backslashes
arg = arg.replace(/(\\*)$/, '$1$1');
// All other backslashes occur literally
// Quote the whole thing:
arg = '"' + arg + '"';
}
return arg;
}
module.exports = escapeArgument;

12
tools/eslint/node_modules/cross-spawn/lib/util/escapeCommand.js

@ -0,0 +1,12 @@
'use strict';
var escapeArgument = require('./escapeArgument');
function escapeCommand(command) {
// Do not escape if this command is not dangerous..
// We do this so that commands like "echo" or "ifconfig" work
// Quoting them, will make them unaccessible
return /^[a-z0-9_-]+$/i.test(command) ? command : escapeArgument(command, true);
}
module.exports = escapeCommand;

18
tools/eslint/node_modules/cross-spawn/lib/util/hasEmptyArgumentBug.js

@ -0,0 +1,18 @@
'use strict';
// See: https://github.com/IndigoUnited/node-cross-spawn/pull/34#issuecomment-221623455
function hasEmptyArgumentBug() {
var nodeVer;
if (process.platform !== 'win32') {
return false;
}
nodeVer = process.version.substr(1).split('.').map(function (num) {
return parseInt(num, 10);
});
return (nodeVer[0] === 0 && nodeVer[1] < 12);
}
module.exports = hasEmptyArgumentBug();

37
tools/eslint/node_modules/cross-spawn/lib/util/readShebang.js

@ -0,0 +1,37 @@
'use strict';
var fs = require('fs');
var LRU = require('lru-cache');
var shebangCommand = require('shebang-command');
var shebangCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec
function readShebang(command) {
var buffer;
var fd;
var shebang;
// Check if it is in the cache first
if (shebangCache.has(command)) {
return shebangCache.get(command);
}
// Read the first 150 bytes from the file
buffer = new Buffer(150);
try {
fd = fs.openSync(command, 'r');
fs.readSync(fd, buffer, 0, 150, 0);
fs.closeSync(fd);
} catch (e) { /* empty */ }
// Attempt to extract shebang (null is returned if not a shebang)
shebang = shebangCommand(buffer.toString());
// Store the shebang in the cache
shebangCache.set(command, shebang);
return shebang;
}
module.exports = readShebang;

31
tools/eslint/node_modules/cross-spawn/lib/util/resolveCommand.js

@ -0,0 +1,31 @@
'use strict';
var path = require('path');
var which = require('which');
var LRU = require('lru-cache');
var commandCache = new LRU({ max: 50, maxAge: 30 * 1000 }); // Cache just for 30sec
function resolveCommand(command, noExtension) {
var resolved;
noExtension = !!noExtension;
resolved = commandCache.get(command + '!' + noExtension);
// Check if its resolved in the cache
if (commandCache.has(command)) {
return commandCache.get(command);
}
try {
resolved = !noExtension ?
which.sync(command) :
which.sync(command, { pathExt: path.delimiter + (process.env.PATHEXT || '') });
} catch (e) { /* empty */ }
commandCache.set(command + '!' + noExtension, resolved);
return resolved;
}
module.exports = resolveCommand;

83
tools/eslint/node_modules/cross-spawn/package.json

@ -0,0 +1,83 @@
{
"_from": "cross-spawn@^5.1.0",
"_id": "cross-spawn@5.1.0",
"_inBundle": false,
"_integrity": "sha1-6L0O/uWPz/b4+UUQoKVUu/ojVEk=",
"_location": "/eslint/cross-spawn",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "cross-spawn@^5.1.0",
"name": "cross-spawn",
"escapedName": "cross-spawn",
"rawSpec": "^5.1.0",
"saveSpec": null,
"fetchSpec": "^5.1.0"
},
"_requiredBy": [
"/eslint"
],
"_resolved": "https://registry.npmjs.org/cross-spawn/-/cross-spawn-5.1.0.tgz",
"_shasum": "e8bd0efee58fcff6f8f94510a0a554bbfa235449",
"_spec": "cross-spawn@^5.1.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint",
"author": {
"name": "IndigoUnited",
"email": "hello@indigounited.com",
"url": "http://indigounited.com"
},
"bugs": {
"url": "https://github.com/IndigoUnited/node-cross-spawn/issues/"
},
"bundleDependencies": false,
"dependencies": {
"lru-cache": "^4.0.1",
"shebang-command": "^1.2.0",
"which": "^1.2.9"
},
"deprecated": false,
"description": "Cross platform child_process#spawn and child_process#spawnSync",
"devDependencies": {
"@satazor/eslint-config": "^3.0.0",
"eslint": "^3.0.0",
"expect.js": "^0.3.0",
"glob": "^7.0.0",
"mkdirp": "^0.5.1",
"mocha": "^3.0.2",
"once": "^1.4.0",
"rimraf": "^2.5.0"
},
"files": [
"index.js",
"lib"
],
"homepage": "https://github.com/IndigoUnited/node-cross-spawn#readme",
"keywords": [
"spawn",
"spawnSync",
"windows",
"cross",
"platform",
"path",
"ext",
"path-ext",
"path_ext",
"shebang",
"hashbang",
"cmd",
"execute"
],
"license": "MIT",
"main": "index.js",
"name": "cross-spawn",
"repository": {
"type": "git",
"url": "git://github.com/IndigoUnited/node-cross-spawn.git"
},
"scripts": {
"lint": "eslint '{*.js,lib/**/*.js,test/**/*.js}'",
"test": "node test/prepare && mocha --bail test/test"
},
"version": "5.1.0"
}

22
tools/eslint/node_modules/functional-red-black-tree/LICENSE

@ -0,0 +1,22 @@
The MIT License (MIT)
Copyright (c) 2013 Mikola Lysenko
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

237
tools/eslint/node_modules/functional-red-black-tree/README.md

@ -0,0 +1,237 @@
functional-red-black-tree
=========================
A [fully persistent](http://en.wikipedia.org/wiki/Persistent_data_structure) [red-black tree](http://en.wikipedia.org/wiki/Red%E2%80%93black_tree) written 100% in JavaScript. Works both in node.js and in the browser via [browserify](http://browserify.org/).
Functional (or fully presistent) data structures allow for non-destructive updates. So if you insert an element into the tree, it returns a new tree with the inserted element rather than destructively updating the existing tree in place. Doing this requires using extra memory, and if one were naive it could cost as much as reallocating the entire tree. Instead, this data structure saves some memory by recycling references to previously allocated subtrees. This requires using only O(log(n)) additional memory per update instead of a full O(n) copy.
Some advantages of this is that it is possible to apply insertions and removals to the tree while still iterating over previous versions of the tree. Functional and persistent data structures can also be useful in many geometric algorithms like point location within triangulations or ray queries, and can be used to analyze the history of executing various algorithms. This added power though comes at a cost, since it is generally a bit slower to use a functional data structure than an imperative version. However, if your application needs this behavior then you may consider using this module.
# Install
npm install functional-red-black-tree
# Example
Here is an example of some basic usage:
```javascript
//Load the library
var createTree = require("functional-red-black-tree")
//Create a tree
var t1 = createTree()
//Insert some items into the tree
var t2 = t1.insert(1, "foo")
var t3 = t2.insert(2, "bar")
//Remove something
var t4 = t3.remove(1)
```
# API
```javascript
var createTree = require("functional-red-black-tree")
```
## Overview
- [Tree methods](#tree-methods)
- [`var tree = createTree([compare])`](#var-tree-=-createtreecompare)
- [`tree.keys`](#treekeys)
- [`tree.values`](#treevalues)
- [`tree.length`](#treelength)
- [`tree.get(key)`](#treegetkey)
- [`tree.insert(key, value)`](#treeinsertkey-value)
- [`tree.remove(key)`](#treeremovekey)
- [`tree.find(key)`](#treefindkey)
- [`tree.ge(key)`](#treegekey)
- [`tree.gt(key)`](#treegtkey)
- [`tree.lt(key)`](#treeltkey)
- [`tree.le(key)`](#treelekey)
- [`tree.at(position)`](#treeatposition)
- [`tree.begin`](#treebegin)
- [`tree.end`](#treeend)
- [`tree.forEach(visitor(key,value)[, lo[, hi]])`](#treeforEachvisitorkeyvalue-lo-hi)
- [`tree.root`](#treeroot)
- [Node properties](#node-properties)
- [`node.key`](#nodekey)
- [`node.value`](#nodevalue)
- [`node.left`](#nodeleft)
- [`node.right`](#noderight)
- [Iterator methods](#iterator-methods)
- [`iter.key`](#iterkey)
- [`iter.value`](#itervalue)
- [`iter.node`](#iternode)
- [`iter.tree`](#itertree)
- [`iter.index`](#iterindex)
- [`iter.valid`](#itervalid)
- [`iter.clone()`](#iterclone)
- [`iter.remove()`](#iterremove)
- [`iter.update(value)`](#iterupdatevalue)
- [`iter.next()`](#iternext)
- [`iter.prev()`](#iterprev)
- [`iter.hasNext`](#iterhasnext)
- [`iter.hasPrev`](#iterhasprev)
## Tree methods
### `var tree = createTree([compare])`
Creates an empty functional tree
* `compare` is an optional comparison function, same semantics as array.sort()
**Returns** An empty tree ordered by `compare`
### `tree.keys`
A sorted array of all the keys in the tree
### `tree.values`
An array array of all the values in the tree
### `tree.length`
The number of items in the tree
### `tree.get(key)`
Retrieves the value associated to the given key
* `key` is the key of the item to look up
**Returns** The value of the first node associated to `key`
### `tree.insert(key, value)`
Creates a new tree with the new pair inserted.
* `key` is the key of the item to insert
* `value` is the value of the item to insert
**Returns** A new tree with `key` and `value` inserted
### `tree.remove(key)`
Removes the first item with `key` in the tree
* `key` is the key of the item to remove
**Returns** A new tree with the given item removed if it exists
### `tree.find(key)`
Returns an iterator pointing to the first item in the tree with `key`, otherwise `null`.
### `tree.ge(key)`
Find the first item in the tree whose key is `>= key`
* `key` is the key to search for
**Returns** An iterator at the given element.
### `tree.gt(key)`
Finds the first item in the tree whose key is `> key`
* `key` is the key to search for
**Returns** An iterator at the given element
### `tree.lt(key)`
Finds the last item in the tree whose key is `< key`
* `key` is the key to search for
**Returns** An iterator at the given element
### `tree.le(key)`
Finds the last item in the tree whose key is `<= key`
* `key` is the key to search for
**Returns** An iterator at the given element
### `tree.at(position)`
Finds an iterator starting at the given element
* `position` is the index at which the iterator gets created
**Returns** An iterator starting at position
### `tree.begin`
An iterator pointing to the first element in the tree
### `tree.end`
An iterator pointing to the last element in the tree
### `tree.forEach(visitor(key,value)[, lo[, hi]])`
Walks a visitor function over the nodes of the tree in order.
* `visitor(key,value)` is a callback that gets executed on each node. If a truthy value is returned from the visitor, then iteration is stopped.
* `lo` is an optional start of the range to visit (inclusive)
* `hi` is an optional end of the range to visit (non-inclusive)
**Returns** The last value returned by the callback
### `tree.root`
Returns the root node of the tree
## Node properties
Each node of the tree has the following properties:
### `node.key`
The key associated to the node
### `node.value`
The value associated to the node
### `node.left`
The left subtree of the node
### `node.right`
The right subtree of the node
## Iterator methods
### `iter.key`
The key of the item referenced by the iterator
### `iter.value`
The value of the item referenced by the iterator
### `iter.node`
The value of the node at the iterator's current position. `null` is iterator is node valid.
### `iter.tree`
The tree associated to the iterator
### `iter.index`
Returns the position of this iterator in the sequence.
### `iter.valid`
Checks if the iterator is valid
### `iter.clone()`
Makes a copy of the iterator
### `iter.remove()`
Removes the item at the position of the iterator
**Returns** A new binary search tree with `iter`'s item removed
### `iter.update(value)`
Updates the value of the node in the tree at this iterator
**Returns** A new binary search tree with the corresponding node updated
### `iter.next()`
Advances the iterator to the next position
### `iter.prev()`
Moves the iterator backward one element
### `iter.hasNext`
If true, then the iterator is not at the end of the sequence
### `iter.hasPrev`
If true, then the iterator is not at the beginning of the sequence
# Credits
(c) 2013 Mikola Lysenko. MIT License

11
tools/eslint/node_modules/functional-red-black-tree/bench/test.js

@ -0,0 +1,11 @@
"use strict"
var createTree = require("../rbtree.js")
var t = createTree()
var s = Date.now()
for(var i=0; i<100000; ++i) {
t = t.insert(Math.random(), Math.random())
}
console.log(Date.now() - s)

68
tools/eslint/node_modules/functional-red-black-tree/package.json

@ -0,0 +1,68 @@
{
"_from": "functional-red-black-tree@^1.0.1",
"_id": "functional-red-black-tree@1.0.1",
"_inBundle": false,
"_integrity": "sha1-GwqzvVU7Kg1jmdKcDj6gslIHgyc=",
"_location": "/eslint/functional-red-black-tree",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "functional-red-black-tree@^1.0.1",
"name": "functional-red-black-tree",
"escapedName": "functional-red-black-tree",
"rawSpec": "^1.0.1",
"saveSpec": null,
"fetchSpec": "^1.0.1"
},
"_requiredBy": [
"/eslint"
],
"_resolved": "https://registry.npmjs.org/functional-red-black-tree/-/functional-red-black-tree-1.0.1.tgz",
"_shasum": "1b0ab3bd553b2a0d6399d29c0e3ea0b252078327",
"_spec": "functional-red-black-tree@^1.0.1",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint",
"author": {
"name": "Mikola Lysenko"
},
"bugs": {
"url": "https://github.com/mikolalysenko/functional-red-black-tree/issues"
},
"bundleDependencies": false,
"dependencies": {},
"deprecated": false,
"description": "A fully persistent balanced binary search tree",
"devDependencies": {
"iota-array": "^0.0.1",
"tape": "^2.12.0"
},
"directories": {
"test": "test"
},
"homepage": "https://github.com/mikolalysenko/functional-red-black-tree#readme",
"keywords": [
"functional",
"red",
"black",
"tree",
"binary",
"search",
"balance",
"persistent",
"fully",
"dynamic",
"data",
"structure"
],
"license": "MIT",
"main": "rbtree.js",
"name": "functional-red-black-tree",
"repository": {
"type": "git",
"url": "git://github.com/mikolalysenko/functional-red-black-tree.git"
},
"scripts": {
"test": "tape test/*.js"
},
"version": "1.0.1"
}

996
tools/eslint/node_modules/functional-red-black-tree/rbtree.js

@ -0,0 +1,996 @@
"use strict"
module.exports = createRBTree
var RED = 0
var BLACK = 1
function RBNode(color, key, value, left, right, count) {
this._color = color
this.key = key
this.value = value
this.left = left
this.right = right
this._count = count
}
function cloneNode(node) {
return new RBNode(node._color, node.key, node.value, node.left, node.right, node._count)
}
function repaint(color, node) {
return new RBNode(color, node.key, node.value, node.left, node.right, node._count)
}
function recount(node) {
node._count = 1 + (node.left ? node.left._count : 0) + (node.right ? node.right._count : 0)
}
function RedBlackTree(compare, root) {
this._compare = compare
this.root = root
}
var proto = RedBlackTree.prototype
Object.defineProperty(proto, "keys", {
get: function() {
var result = []
this.forEach(function(k,v) {
result.push(k)
})
return result
}
})
Object.defineProperty(proto, "values", {
get: function() {
var result = []
this.forEach(function(k,v) {
result.push(v)
})
return result
}
})
//Returns the number of nodes in the tree
Object.defineProperty(proto, "length", {
get: function() {
if(this.root) {
return this.root._count
}
return 0
}
})
//Insert a new item into the tree
proto.insert = function(key, value) {
var cmp = this._compare
//Find point to insert new node at
var n = this.root
var n_stack = []
var d_stack = []
while(n) {
var d = cmp(key, n.key)
n_stack.push(n)
d_stack.push(d)
if(d <= 0) {
n = n.left
} else {
n = n.right
}
}
//Rebuild path to leaf node
n_stack.push(new RBNode(RED, key, value, null, null, 1))
for(var s=n_stack.length-2; s>=0; --s) {
var n = n_stack[s]
if(d_stack[s] <= 0) {
n_stack[s] = new RBNode(n._color, n.key, n.value, n_stack[s+1], n.right, n._count+1)
} else {
n_stack[s] = new RBNode(n._color, n.key, n.value, n.left, n_stack[s+1], n._count+1)
}
}
//Rebalance tree using rotations
//console.log("start insert", key, d_stack)
for(var s=n_stack.length-1; s>1; --s) {
var p = n_stack[s-1]
var n = n_stack[s]
if(p._color === BLACK || n._color === BLACK) {
break
}
var pp = n_stack[s-2]
if(pp.left === p) {
if(p.left === n) {
var y = pp.right
if(y && y._color === RED) {
//console.log("LLr")
p._color = BLACK
pp.right = repaint(BLACK, y)
pp._color = RED
s -= 1
} else {
//console.log("LLb")
pp._color = RED
pp.left = p.right
p._color = BLACK
p.right = pp
n_stack[s-2] = p
n_stack[s-1] = n
recount(pp)
recount(p)
if(s >= 3) {
var ppp = n_stack[s-3]
if(ppp.left === pp) {
ppp.left = p
} else {
ppp.right = p
}
}
break
}
} else {
var y = pp.right
if(y && y._color === RED) {
//console.log("LRr")
p._color = BLACK
pp.right = repaint(BLACK, y)
pp._color = RED
s -= 1
} else {
//console.log("LRb")
p.right = n.left
pp._color = RED
pp.left = n.right
n._color = BLACK
n.left = p
n.right = pp
n_stack[s-2] = n
n_stack[s-1] = p
recount(pp)
recount(p)
recount(n)
if(s >= 3) {
var ppp = n_stack[s-3]
if(ppp.left === pp) {
ppp.left = n
} else {
ppp.right = n
}
}
break
}
}
} else {
if(p.right === n) {
var y = pp.left
if(y && y._color === RED) {
//console.log("RRr", y.key)
p._color = BLACK
pp.left = repaint(BLACK, y)
pp._color = RED
s -= 1
} else {
//console.log("RRb")
pp._color = RED
pp.right = p.left
p._color = BLACK
p.left = pp
n_stack[s-2] = p
n_stack[s-1] = n
recount(pp)
recount(p)
if(s >= 3) {
var ppp = n_stack[s-3]
if(ppp.right === pp) {
ppp.right = p
} else {
ppp.left = p
}
}
break
}
} else {
var y = pp.left
if(y && y._color === RED) {
//console.log("RLr")
p._color = BLACK
pp.left = repaint(BLACK, y)
pp._color = RED
s -= 1
} else {
//console.log("RLb")
p.left = n.right
pp._color = RED
pp.right = n.left
n._color = BLACK
n.right = p
n.left = pp
n_stack[s-2] = n
n_stack[s-1] = p
recount(pp)
recount(p)
recount(n)
if(s >= 3) {
var ppp = n_stack[s-3]
if(ppp.right === pp) {
ppp.right = n
} else {
ppp.left = n
}
}
break
}
}
}
}
//Return new tree
n_stack[0]._color = BLACK
return new RedBlackTree(cmp, n_stack[0])
}
//Visit all nodes inorder
function doVisitFull(visit, node) {
if(node.left) {
var v = doVisitFull(visit, node.left)
if(v) { return v }
}
var v = visit(node.key, node.value)
if(v) { return v }
if(node.right) {
return doVisitFull(visit, node.right)
}
}
//Visit half nodes in order
function doVisitHalf(lo, compare, visit, node) {
var l = compare(lo, node.key)
if(l <= 0) {
if(node.left) {
var v = doVisitHalf(lo, compare, visit, node.left)
if(v) { return v }
}
var v = visit(node.key, node.value)
if(v) { return v }
}
if(node.right) {
return doVisitHalf(lo, compare, visit, node.right)
}
}
//Visit all nodes within a range
function doVisit(lo, hi, compare, visit, node) {
var l = compare(lo, node.key)
var h = compare(hi, node.key)
var v
if(l <= 0) {
if(node.left) {
v = doVisit(lo, hi, compare, visit, node.left)
if(v) { return v }
}
if(h > 0) {
v = visit(node.key, node.value)
if(v) { return v }
}
}
if(h > 0 && node.right) {
return doVisit(lo, hi, compare, visit, node.right)
}
}
proto.forEach = function rbTreeForEach(visit, lo, hi) {
if(!this.root) {
return
}
switch(arguments.length) {
case 1:
return doVisitFull(visit, this.root)
break
case 2:
return doVisitHalf(lo, this._compare, visit, this.root)
break
case 3:
if(this._compare(lo, hi) >= 0) {
return
}
return doVisit(lo, hi, this._compare, visit, this.root)
break
}
}
//First item in list
Object.defineProperty(proto, "begin", {
get: function() {
var stack = []
var n = this.root
while(n) {
stack.push(n)
n = n.left
}
return new RedBlackTreeIterator(this, stack)
}
})
//Last item in list
Object.defineProperty(proto, "end", {
get: function() {
var stack = []
var n = this.root
while(n) {
stack.push(n)
n = n.right
}
return new RedBlackTreeIterator(this, stack)
}
})
//Find the ith item in the tree
proto.at = function(idx) {
if(idx < 0) {
return new RedBlackTreeIterator(this, [])
}
var n = this.root
var stack = []
while(true) {
stack.push(n)
if(n.left) {
if(idx < n.left._count) {
n = n.left
continue
}
idx -= n.left._count
}
if(!idx) {
return new RedBlackTreeIterator(this, stack)
}
idx -= 1
if(n.right) {
if(idx >= n.right._count) {
break
}
n = n.right
} else {
break
}
}
return new RedBlackTreeIterator(this, [])
}
proto.ge = function(key) {
var cmp = this._compare
var n = this.root
var stack = []
var last_ptr = 0
while(n) {
var d = cmp(key, n.key)
stack.push(n)
if(d <= 0) {
last_ptr = stack.length
}
if(d <= 0) {
n = n.left
} else {
n = n.right
}
}
stack.length = last_ptr
return new RedBlackTreeIterator(this, stack)
}
proto.gt = function(key) {
var cmp = this._compare
var n = this.root
var stack = []
var last_ptr = 0
while(n) {
var d = cmp(key, n.key)
stack.push(n)
if(d < 0) {
last_ptr = stack.length
}
if(d < 0) {
n = n.left
} else {
n = n.right
}
}
stack.length = last_ptr
return new RedBlackTreeIterator(this, stack)
}
proto.lt = function(key) {
var cmp = this._compare
var n = this.root
var stack = []
var last_ptr = 0
while(n) {
var d = cmp(key, n.key)
stack.push(n)
if(d > 0) {
last_ptr = stack.length
}
if(d <= 0) {
n = n.left
} else {
n = n.right
}
}
stack.length = last_ptr
return new RedBlackTreeIterator(this, stack)
}
proto.le = function(key) {
var cmp = this._compare
var n = this.root
var stack = []
var last_ptr = 0
while(n) {
var d = cmp(key, n.key)
stack.push(n)
if(d >= 0) {
last_ptr = stack.length
}
if(d < 0) {
n = n.left
} else {
n = n.right
}
}
stack.length = last_ptr
return new RedBlackTreeIterator(this, stack)
}
//Finds the item with key if it exists
proto.find = function(key) {
var cmp = this._compare
var n = this.root
var stack = []
while(n) {
var d = cmp(key, n.key)
stack.push(n)
if(d === 0) {
return new RedBlackTreeIterator(this, stack)
}
if(d <= 0) {
n = n.left
} else {
n = n.right
}
}
return new RedBlackTreeIterator(this, [])
}
//Removes item with key from tree
proto.remove = function(key) {
var iter = this.find(key)
if(iter) {
return iter.remove()
}
return this
}
//Returns the item at `key`
proto.get = function(key) {
var cmp = this._compare
var n = this.root
while(n) {
var d = cmp(key, n.key)
if(d === 0) {
return n.value
}
if(d <= 0) {
n = n.left
} else {
n = n.right
}
}
return
}
//Iterator for red black tree
function RedBlackTreeIterator(tree, stack) {
this.tree = tree
this._stack = stack
}
var iproto = RedBlackTreeIterator.prototype
//Test if iterator is valid
Object.defineProperty(iproto, "valid", {
get: function() {
return this._stack.length > 0
}
})
//Node of the iterator
Object.defineProperty(iproto, "node", {
get: function() {
if(this._stack.length > 0) {
return this._stack[this._stack.length-1]
}
return null
},
enumerable: true
})
//Makes a copy of an iterator
iproto.clone = function() {
return new RedBlackTreeIterator(this.tree, this._stack.slice())
}
//Swaps two nodes
function swapNode(n, v) {
n.key = v.key
n.value = v.value
n.left = v.left
n.right = v.right
n._color = v._color
n._count = v._count
}
//Fix up a double black node in a tree
function fixDoubleBlack(stack) {
var n, p, s, z
for(var i=stack.length-1; i>=0; --i) {
n = stack[i]
if(i === 0) {
n._color = BLACK
return
}
//console.log("visit node:", n.key, i, stack[i].key, stack[i-1].key)
p = stack[i-1]
if(p.left === n) {
//console.log("left child")
s = p.right
if(s.right && s.right._color === RED) {
//console.log("case 1: right sibling child red")
s = p.right = cloneNode(s)
z = s.right = cloneNode(s.right)
p.right = s.left
s.left = p
s.right = z
s._color = p._color
n._color = BLACK
p._color = BLACK
z._color = BLACK
recount(p)
recount(s)
if(i > 1) {
var pp = stack[i-2]
if(pp.left === p) {
pp.left = s
} else {
pp.right = s
}
}
stack[i-1] = s
return
} else if(s.left && s.left._color === RED) {
//console.log("case 1: left sibling child red")
s = p.right = cloneNode(s)
z = s.left = cloneNode(s.left)
p.right = z.left
s.left = z.right
z.left = p
z.right = s
z._color = p._color
p._color = BLACK
s._color = BLACK
n._color = BLACK
recount(p)
recount(s)
recount(z)
if(i > 1) {
var pp = stack[i-2]
if(pp.left === p) {
pp.left = z
} else {
pp.right = z
}
}
stack[i-1] = z
return
}
if(s._color === BLACK) {
if(p._color === RED) {
//console.log("case 2: black sibling, red parent", p.right.value)
p._color = BLACK
p.right = repaint(RED, s)
return
} else {
//console.log("case 2: black sibling, black parent", p.right.value)
p.right = repaint(RED, s)
continue
}
} else {
//console.log("case 3: red sibling")
s = cloneNode(s)
p.right = s.left
s.left = p
s._color = p._color
p._color = RED
recount(p)
recount(s)
if(i > 1) {
var pp = stack[i-2]
if(pp.left === p) {
pp.left = s
} else {
pp.right = s
}
}
stack[i-1] = s
stack[i] = p
if(i+1 < stack.length) {
stack[i+1] = n
} else {
stack.push(n)
}
i = i+2
}
} else {
//console.log("right child")
s = p.left
if(s.left && s.left._color === RED) {
//console.log("case 1: left sibling child red", p.value, p._color)
s = p.left = cloneNode(s)
z = s.left = cloneNode(s.left)
p.left = s.right
s.right = p
s.left = z
s._color = p._color
n._color = BLACK
p._color = BLACK
z._color = BLACK
recount(p)
recount(s)
if(i > 1) {
var pp = stack[i-2]
if(pp.right === p) {
pp.right = s
} else {
pp.left = s
}
}
stack[i-1] = s
return
} else if(s.right && s.right._color === RED) {
//console.log("case 1: right sibling child red")
s = p.left = cloneNode(s)
z = s.right = cloneNode(s.right)
p.left = z.right
s.right = z.left
z.right = p
z.left = s
z._color = p._color
p._color = BLACK
s._color = BLACK
n._color = BLACK
recount(p)
recount(s)
recount(z)
if(i > 1) {
var pp = stack[i-2]
if(pp.right === p) {
pp.right = z
} else {
pp.left = z
}
}
stack[i-1] = z
return
}
if(s._color === BLACK) {
if(p._color === RED) {
//console.log("case 2: black sibling, red parent")
p._color = BLACK
p.left = repaint(RED, s)
return
} else {
//console.log("case 2: black sibling, black parent")
p.left = repaint(RED, s)
continue
}
} else {
//console.log("case 3: red sibling")
s = cloneNode(s)
p.left = s.right
s.right = p
s._color = p._color
p._color = RED
recount(p)
recount(s)
if(i > 1) {
var pp = stack[i-2]
if(pp.right === p) {
pp.right = s
} else {
pp.left = s
}
}
stack[i-1] = s
stack[i] = p
if(i+1 < stack.length) {
stack[i+1] = n
} else {
stack.push(n)
}
i = i+2
}
}
}
}
//Removes item at iterator from tree
iproto.remove = function() {
var stack = this._stack
if(stack.length === 0) {
return this.tree
}
//First copy path to node
var cstack = new Array(stack.length)
var n = stack[stack.length-1]
cstack[cstack.length-1] = new RBNode(n._color, n.key, n.value, n.left, n.right, n._count)
for(var i=stack.length-2; i>=0; --i) {
var n = stack[i]
if(n.left === stack[i+1]) {
cstack[i] = new RBNode(n._color, n.key, n.value, cstack[i+1], n.right, n._count)
} else {
cstack[i] = new RBNode(n._color, n.key, n.value, n.left, cstack[i+1], n._count)
}
}
//Get node
n = cstack[cstack.length-1]
//console.log("start remove: ", n.value)
//If not leaf, then swap with previous node
if(n.left && n.right) {
//console.log("moving to leaf")
//First walk to previous leaf
var split = cstack.length
n = n.left
while(n.right) {
cstack.push(n)
n = n.right
}
//Copy path to leaf
var v = cstack[split-1]
cstack.push(new RBNode(n._color, v.key, v.value, n.left, n.right, n._count))
cstack[split-1].key = n.key
cstack[split-1].value = n.value
//Fix up stack
for(var i=cstack.length-2; i>=split; --i) {
n = cstack[i]
cstack[i] = new RBNode(n._color, n.key, n.value, n.left, cstack[i+1], n._count)
}
cstack[split-1].left = cstack[split]
}
//console.log("stack=", cstack.map(function(v) { return v.value }))
//Remove leaf node
n = cstack[cstack.length-1]
if(n._color === RED) {
//Easy case: removing red leaf
//console.log("RED leaf")
var p = cstack[cstack.length-2]
if(p.left === n) {
p.left = null
} else if(p.right === n) {
p.right = null
}
cstack.pop()
for(var i=0; i<cstack.length; ++i) {
cstack[i]._count--
}
return new RedBlackTree(this.tree._compare, cstack[0])
} else {
if(n.left || n.right) {
//Second easy case: Single child black parent
//console.log("BLACK single child")
if(n.left) {
swapNode(n, n.left)
} else if(n.right) {
swapNode(n, n.right)
}
//Child must be red, so repaint it black to balance color
n._color = BLACK
for(var i=0; i<cstack.length-1; ++i) {
cstack[i]._count--
}
return new RedBlackTree(this.tree._compare, cstack[0])
} else if(cstack.length === 1) {
//Third easy case: root
//console.log("ROOT")
return new RedBlackTree(this.tree._compare, null)
} else {
//Hard case: Repaint n, and then do some nasty stuff
//console.log("BLACK leaf no children")
for(var i=0; i<cstack.length; ++i) {
cstack[i]._count--
}
var parent = cstack[cstack.length-2]
fixDoubleBlack(cstack)
//Fix up links
if(parent.left === n) {
parent.left = null
} else {
parent.right = null
}
}
}
return new RedBlackTree(this.tree._compare, cstack[0])
}
//Returns key
Object.defineProperty(iproto, "key", {
get: function() {
if(this._stack.length > 0) {
return this._stack[this._stack.length-1].key
}
return
},
enumerable: true
})
//Returns value
Object.defineProperty(iproto, "value", {
get: function() {
if(this._stack.length > 0) {
return this._stack[this._stack.length-1].value
}
return
},
enumerable: true
})
//Returns the position of this iterator in the sorted list
Object.defineProperty(iproto, "index", {
get: function() {
var idx = 0
var stack = this._stack
if(stack.length === 0) {
var r = this.tree.root
if(r) {
return r._count
}
return 0
} else if(stack[stack.length-1].left) {
idx = stack[stack.length-1].left._count
}
for(var s=stack.length-2; s>=0; --s) {
if(stack[s+1] === stack[s].right) {
++idx
if(stack[s].left) {
idx += stack[s].left._count
}
}
}
return idx
},
enumerable: true
})
//Advances iterator to next element in list
iproto.next = function() {
var stack = this._stack
if(stack.length === 0) {
return
}
var n = stack[stack.length-1]
if(n.right) {
n = n.right
while(n) {
stack.push(n)
n = n.left
}
} else {
stack.pop()
while(stack.length > 0 && stack[stack.length-1].right === n) {
n = stack[stack.length-1]
stack.pop()
}
}
}
//Checks if iterator is at end of tree
Object.defineProperty(iproto, "hasNext", {
get: function() {
var stack = this._stack
if(stack.length === 0) {
return false
}
if(stack[stack.length-1].right) {
return true
}
for(var s=stack.length-1; s>0; --s) {
if(stack[s-1].left === stack[s]) {
return true
}
}
return false
}
})
//Update value
iproto.update = function(value) {
var stack = this._stack
if(stack.length === 0) {
throw new Error("Can't update empty node!")
}
var cstack = new Array(stack.length)
var n = stack[stack.length-1]
cstack[cstack.length-1] = new RBNode(n._color, n.key, value, n.left, n.right, n._count)
for(var i=stack.length-2; i>=0; --i) {
n = stack[i]
if(n.left === stack[i+1]) {
cstack[i] = new RBNode(n._color, n.key, n.value, cstack[i+1], n.right, n._count)
} else {
cstack[i] = new RBNode(n._color, n.key, n.value, n.left, cstack[i+1], n._count)
}
}
return new RedBlackTree(this.tree._compare, cstack[0])
}
//Moves iterator backward one element
iproto.prev = function() {
var stack = this._stack
if(stack.length === 0) {
return
}
var n = stack[stack.length-1]
if(n.left) {
n = n.left
while(n) {
stack.push(n)
n = n.right
}
} else {
stack.pop()
while(stack.length > 0 && stack[stack.length-1].left === n) {
n = stack[stack.length-1]
stack.pop()
}
}
}
//Checks if iterator is at start of tree
Object.defineProperty(iproto, "hasPrev", {
get: function() {
var stack = this._stack
if(stack.length === 0) {
return false
}
if(stack[stack.length-1].left) {
return true
}
for(var s=stack.length-1; s>0; --s) {
if(stack[s-1].right === stack[s]) {
return true
}
}
return false
}
})
//Default comparison function
function defaultCompare(a, b) {
if(a < b) {
return -1
}
if(a > b) {
return 1
}
return 0
}
//Build a tree
function createRBTree(compare) {
return new RedBlackTree(compare || defaultCompare, null)
}

6
tools/eslint/node_modules/is-alphabetical/history.md

@ -1,6 +0,0 @@
<!--remark setext-->
<!--lint disable no-multiple-toplevel-headings -->
1.0.0 / 2016-07-11
==================

20
tools/eslint/node_modules/is-alphabetical/index.js

@ -1,25 +1,9 @@
/**
* @author Titus Wormer
* @copyright 2016 Titus Wormer
* @license MIT
* @module is-alphabetical
* @fileoverview Check if a character is alphabetical.
*/
'use strict'; 'use strict';
/* eslint-env commonjs */
/* Expose. */
module.exports = alphabetical; module.exports = alphabetical;
/** /* Check if the given character code, or the character
* Check whether the given character code, or the character * code at the first character, is alphabetical. */
* code at the first character, is alphabetical.
*
* @param {string|number} character
* @return {boolean} - Whether `character` is alphabetical.
*/
function alphabetical(character) { function alphabetical(character) {
var code = typeof character === 'string' ? var code = typeof character === 'string' ?
character.charCodeAt(0) : character; character.charCodeAt(0) : character;

43
tools/eslint/node_modules/is-alphabetical/package.json

@ -1,8 +1,8 @@
{ {
"_from": "is-alphabetical@^1.0.0", "_from": "is-alphabetical@^1.0.0",
"_id": "is-alphabetical@1.0.0", "_id": "is-alphabetical@1.0.1",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-4lRMEwWCVfIUTLdXBmzTNCocjEY=", "_integrity": "sha1-x3B5zJHU76x3W+EDS/LSQ/lebwg=",
"_location": "/is-alphabetical", "_location": "/is-alphabetical",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -19,8 +19,8 @@
"/is-alphanumerical", "/is-alphanumerical",
"/remark-parse" "/remark-parse"
], ],
"_resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.0.tgz", "_resolved": "https://registry.npmjs.org/is-alphabetical/-/is-alphabetical-1.0.1.tgz",
"_shasum": "e2544c13058255f2144cb757066cd3342a1c8c46", "_shasum": "c77079cc91d4efac775be1034bf2d243f95e6f08",
"_spec": "is-alphabetical@^1.0.0", "_spec": "is-alphabetical@^1.0.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/remark-parse", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/remark-parse",
"author": { "author": {
@ -43,16 +43,13 @@
"deprecated": false, "deprecated": false,
"description": "Check if a character is alphabetical", "description": "Check if a character is alphabetical",
"devDependencies": { "devDependencies": {
"browserify": "^13.0.1", "browserify": "^14.1.0",
"esmangle": "^1.0.1", "esmangle": "^1.0.1",
"nyc": "^7.0.0", "nyc": "^11.0.0",
"remark-cli": "^1.0.0", "remark-cli": "^3.0.0",
"remark-comment-config": "^4.0.0", "remark-preset-wooorm": "^3.0.0",
"remark-github": "^5.0.0",
"remark-lint": "^4.0.0",
"remark-validate-links": "^4.0.0",
"tape": "^4.0.0", "tape": "^4.0.0",
"xo": "^0.16.0" "xo": "^0.18.0"
}, },
"files": [ "files": [
"index.js" "index.js"
@ -74,16 +71,9 @@
"branches": 100 "branches": 100
}, },
"remarkConfig": { "remarkConfig": {
"output": true,
"plugins": [ "plugins": [
"comment-config", "preset-wooorm"
"github", ]
"lint",
"validate-links"
],
"settings": {
"bullet": "*"
}
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -93,18 +83,21 @@
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", "build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js --bare -s isAlphabetical > is-alphabetical.js", "build-bundle": "browserify index.js --bare -s isAlphabetical > is-alphabetical.js",
"build-mangle": "esmangle < is-alphabetical.js > is-alphabetical.min.js", "build-mangle": "esmangle < is-alphabetical.js > is-alphabetical.min.js",
"build-md": "remark . --quiet --frail", "build-md": "remark . -qfo",
"lint": "xo", "lint": "xo",
"test": "npm run build && npm run lint && npm run test-coverage", "test": "npm run build && npm run lint && npm run test-coverage",
"test-api": "node test", "test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js" "test-coverage": "nyc --reporter lcov tape test.js"
}, },
"version": "1.0.0", "version": "1.0.1",
"xo": { "xo": {
"space": true, "space": true,
"esnext": false,
"rules": {
"capitalized-comments": "off"
},
"ignores": [ "ignores": [
"is-alphabetical.js", "is-alphabetical.js"
"is-alphabetical.min.js"
] ]
} }
} }

13
tools/eslint/node_modules/is-alphabetical/readme.md

@ -1,12 +1,10 @@
# is-alphabetical [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] # is-alphabetical [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]
<!--lint disable heading-increment list-item-spacing-->
Check if a character is alphabetical. Check if a character is alphabetical.
## Installation ## Installation
[npm][npm-install]: [npm][]:
```bash ```bash
npm install is-alphabetical npm install is-alphabetical
@ -14,8 +12,6 @@ npm install is-alphabetical
## Usage ## Usage
Dependencies:
```javascript ```javascript
var alphabetical = require('is-alphabetical'); var alphabetical = require('is-alphabetical');
@ -27,7 +23,7 @@ alphabetical('💩'); // false
## API ## API
### `alphabetical(character)` ### `alphabetical(character|code)`
Check whether the given character code (`number`), or the character Check whether the given character code (`number`), or the character
code at the first position (`string`), is alphabetical. code at the first position (`string`), is alphabetical.
@ -36,6 +32,9 @@ code at the first position (`string`), is alphabetical.
* [`is-decimal`](https://github.com/wooorm/is-decimal) * [`is-decimal`](https://github.com/wooorm/is-decimal)
* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) * [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal)
* [`is-alphanumerical`](https://github.com/wooorm/is-alphanumerical)
* [`is-whitespace-character`](https://github.com/wooorm/is-whitespace-character)
* [`is-word-character`](https://github.com/wooorm/is-word-character)
## License ## License
@ -51,7 +50,7 @@ code at the first position (`string`), is alphabetical.
[codecov]: https://codecov.io/github/wooorm/is-alphabetical [codecov]: https://codecov.io/github/wooorm/is-alphabetical
[npm-install]: https://docs.npmjs.com/cli/install [npm]: https://docs.npmjs.com/cli/install
[license]: LICENSE [license]: LICENSE

6
tools/eslint/node_modules/is-alphanumerical/history.md

@ -1,6 +0,0 @@
<!--remark setext-->
<!--lint disable no-multiple-toplevel-headings -->
1.0.0 / 2016-07-12
==================

21
tools/eslint/node_modules/is-alphanumerical/index.js

@ -1,29 +1,12 @@
/**
* @author Titus Wormer
* @copyright 2016 Titus Wormer
* @license MIT
* @module is-alphanumerical
* @fileoverview Check if a character is alphanumerical.
*/
'use strict'; 'use strict';
/* eslint-env commonjs */
/* Dependencies. */
var alphabetical = require('is-alphabetical'); var alphabetical = require('is-alphabetical');
var decimal = require('is-decimal'); var decimal = require('is-decimal');
/* Expose. */
module.exports = alphanumerical; module.exports = alphanumerical;
/** /* Check if the given character code, or the character
* Check whether the given character code, or the character * code at the first character, is alphanumerical. */
* code at the first character, is alphanumerical.
*
* @param {string|number} character
* @return {boolean} - Whether `character` is alphanumerical.
*/
function alphanumerical(character) { function alphanumerical(character) {
return alphabetical(character) || decimal(character); return alphabetical(character) || decimal(character);
} }

40
tools/eslint/node_modules/is-alphanumerical/package.json

@ -1,8 +1,8 @@
{ {
"_from": "is-alphanumerical@^1.0.0", "_from": "is-alphanumerical@^1.0.0",
"_id": "is-alphanumerical@1.0.0", "_id": "is-alphanumerical@1.0.1",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-4GSS5xnBvxXewjnk8a9fZ7TW578=", "_integrity": "sha1-37SqTRCF4zvbYcLe6cgOnGwZ9Ts=",
"_location": "/is-alphanumerical", "_location": "/is-alphanumerical",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -18,8 +18,8 @@
"_requiredBy": [ "_requiredBy": [
"/parse-entities" "/parse-entities"
], ],
"_resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.0.tgz", "_resolved": "https://registry.npmjs.org/is-alphanumerical/-/is-alphanumerical-1.0.1.tgz",
"_shasum": "e06492e719c1bf15dec239e4f1af5f67b4d6e7bf", "_shasum": "dfb4aa4d1085e33bdb61c2dee9c80e9c6c19f53b",
"_spec": "is-alphanumerical@^1.0.0", "_spec": "is-alphanumerical@^1.0.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/parse-entities", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/parse-entities",
"author": { "author": {
@ -45,16 +45,13 @@
"deprecated": false, "deprecated": false,
"description": "Check if a character is alphanumerical", "description": "Check if a character is alphanumerical",
"devDependencies": { "devDependencies": {
"browserify": "^13.0.1", "browserify": "^14.1.0",
"esmangle": "^1.0.1", "esmangle": "^1.0.1",
"nyc": "^7.0.0", "nyc": "^11.0.0",
"remark-cli": "^1.0.0", "remark-cli": "^3.0.0",
"remark-comment-config": "^4.0.0", "remark-preset-wooorm": "^3.0.0",
"remark-github": "^5.0.0",
"remark-lint": "^4.0.0",
"remark-validate-links": "^4.0.0",
"tape": "^4.0.0", "tape": "^4.0.0",
"xo": "^0.16.0" "xo": "^0.18.0"
}, },
"files": [ "files": [
"index.js" "index.js"
@ -78,16 +75,9 @@
"branches": 100 "branches": 100
}, },
"remarkConfig": { "remarkConfig": {
"output": true,
"plugins": [ "plugins": [
"comment-config", "preset-wooorm"
"github", ]
"lint",
"validate-links"
],
"settings": {
"bullet": "*"
}
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -97,18 +87,18 @@
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", "build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js --bare -s isAlphanumerical > is-alphanumerical.js", "build-bundle": "browserify index.js --bare -s isAlphanumerical > is-alphanumerical.js",
"build-mangle": "esmangle < is-alphanumerical.js > is-alphanumerical.min.js", "build-mangle": "esmangle < is-alphanumerical.js > is-alphanumerical.min.js",
"build-md": "remark . --quiet --frail", "build-md": "remark . -qfo",
"lint": "xo", "lint": "xo",
"test": "npm run build && npm run lint && npm run test-coverage", "test": "npm run build && npm run lint && npm run test-coverage",
"test-api": "node test", "test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js" "test-coverage": "nyc --reporter lcov tape test.js"
}, },
"version": "1.0.0", "version": "1.0.1",
"xo": { "xo": {
"space": true, "space": true,
"esnext": false,
"ignores": [ "ignores": [
"is-alphanumerical.js", "is-alphanumerical.js"
"is-alphanumerical.min.js"
] ]
} }
} }

16
tools/eslint/node_modules/is-alphanumerical/readme.md

@ -1,12 +1,10 @@
# is-alphanumerical [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] # is-alphanumerical [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]
<!--lint disable heading-increment list-item-spacing-->
Check if a character is alphanumerical (`[a-zA-Z0-9]`). Check if a character is alphanumerical (`[a-zA-Z0-9]`).
## Installation ## Installation
[npm][npm-install]: [npm][]:
```bash ```bash
npm install is-alphanumerical npm install is-alphanumerical
@ -17,11 +15,11 @@ npm install is-alphanumerical
```javascript ```javascript
var alphanumerical = require('is-alphanumerical'); var alphanumerical = require('is-alphanumerical');
alphanumerical('a'); // true alphanumerical('a'); //=> true
alphanumerical('Z'); // true alphanumerical('Z'); //=> true
alphanumerical('0'); // true alphanumerical('0'); //=> true
alphanumerical(' '); // false alphanumerical(' '); //=> false
alphanumerical('💩'); // false alphanumerical('💩'); //=> false
``` ```
## API ## API
@ -53,7 +51,7 @@ code at the first position (`string`), is alphanumerical.
[codecov]: https://codecov.io/github/wooorm/is-alphanumerical [codecov]: https://codecov.io/github/wooorm/is-alphanumerical
[npm-install]: https://docs.npmjs.com/cli/install [npm]: https://docs.npmjs.com/cli/install
[license]: LICENSE [license]: LICENSE

6
tools/eslint/node_modules/is-decimal/history.md

@ -1,6 +0,0 @@
<!--remark setext-->
<!--lint disable no-multiple-toplevel-headings -->
1.0.0 / 2016-07-11
==================

20
tools/eslint/node_modules/is-decimal/index.js

@ -1,25 +1,9 @@
/**
* @author Titus Wormer
* @copyright 2016 Titus Wormer
* @license MIT
* @module is-decimal
* @fileoverview Check if a character is decimal.
*/
'use strict'; 'use strict';
/* eslint-env commonjs */
/* Expose. */
module.exports = decimal; module.exports = decimal;
/** /* Check if the given character code, or the character
* Check whether the given character code, or the character * code at the first character, is decimal. */
* code at the first character, is decimal.
*
* @param {string|number} character
* @return {boolean} - Whether `character` is decimal.
*/
function decimal(character) { function decimal(character) {
var code = typeof character === 'string' ? var code = typeof character === 'string' ?
character.charCodeAt(0) : character; character.charCodeAt(0) : character;

40
tools/eslint/node_modules/is-decimal/package.json

@ -1,8 +1,8 @@
{ {
"_from": "is-decimal@^1.0.0", "_from": "is-decimal@^1.0.0",
"_id": "is-decimal@1.0.0", "_id": "is-decimal@1.0.1",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-lAV5tupjxigICmnmK9qIyEcLT+A=", "_integrity": "sha1-9ftqlJlq2ejjdh+/vQkfH8qMToI=",
"_location": "/is-decimal", "_location": "/is-decimal",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -20,8 +20,8 @@
"/parse-entities", "/parse-entities",
"/remark-parse" "/remark-parse"
], ],
"_resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.0.tgz", "_resolved": "https://registry.npmjs.org/is-decimal/-/is-decimal-1.0.1.tgz",
"_shasum": "940579b6ea63c628080a69e62bda88c8470b4fe0", "_shasum": "f5fb6a94996ad9e8e3761fbfbd091f1fca8c4e82",
"_spec": "is-decimal@^1.0.0", "_spec": "is-decimal@^1.0.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/remark-parse", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/remark-parse",
"author": { "author": {
@ -44,16 +44,13 @@
"deprecated": false, "deprecated": false,
"description": "Check if a character is decimal", "description": "Check if a character is decimal",
"devDependencies": { "devDependencies": {
"browserify": "^13.0.1", "browserify": "^14.1.0",
"esmangle": "^1.0.1", "esmangle": "^1.0.1",
"nyc": "^7.0.0", "nyc": "^11.0.0",
"remark-cli": "^1.0.0", "remark-cli": "^3.0.0",
"remark-comment-config": "^4.0.0", "remark-preset-wooorm": "^3.0.0",
"remark-github": "^5.0.0",
"remark-lint": "^4.0.0",
"remark-validate-links": "^4.0.0",
"tape": "^4.0.0", "tape": "^4.0.0",
"xo": "^0.16.0" "xo": "^0.18.0"
}, },
"files": [ "files": [
"index.js" "index.js"
@ -75,16 +72,9 @@
"branches": 100 "branches": 100
}, },
"remarkConfig": { "remarkConfig": {
"output": true,
"plugins": [ "plugins": [
"comment-config", "preset-wooorm"
"github", ]
"lint",
"validate-links"
],
"settings": {
"bullet": "*"
}
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -94,18 +84,18 @@
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", "build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js --bare -s isDecimal > is-decimal.js", "build-bundle": "browserify index.js --bare -s isDecimal > is-decimal.js",
"build-mangle": "esmangle < is-decimal.js > is-decimal.min.js", "build-mangle": "esmangle < is-decimal.js > is-decimal.min.js",
"build-md": "remark . --quiet --frail", "build-md": "remark . -qfo",
"lint": "xo", "lint": "xo",
"test": "npm run build && npm run lint && npm run test-coverage", "test": "npm run build && npm run lint && npm run test-coverage",
"test-api": "node test", "test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js" "test-coverage": "nyc --reporter lcov tape test.js"
}, },
"version": "1.0.0", "version": "1.0.1",
"xo": { "xo": {
"space": true, "space": true,
"esnext": false,
"ignores": [ "ignores": [
"is-decimal.js", "is-decimal.js"
"is-decimal.min.js"
] ]
} }
} }

20
tools/eslint/node_modules/is-decimal/readme.md

@ -1,12 +1,10 @@
# is-decimal [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] # is-decimal [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]
<!--lint disable heading-increment list-item-spacing-->
Check if a character is decimal. Check if a character is decimal.
## Installation ## Installation
[npm][npm-install]: [npm][]:
```bash ```bash
npm install is-decimal npm install is-decimal
@ -14,20 +12,18 @@ npm install is-decimal
## Usage ## Usage
Dependencies:
```javascript ```javascript
var decimal = require('is-decimal'); var decimal = require('is-decimal');
decimal('0'); // true decimal('0'); //=> true
decimal('9'); // true decimal('9'); //=> true
decimal('a'); // false decimal('a'); //=> false
decimal('💩'); // false decimal('💩'); //=> false
``` ```
## API ## API
### `decimal(character)` ### `decimal(character|code)`
Check whether the given character code (`number`), or the character Check whether the given character code (`number`), or the character
code at the first position (`string`), is decimal. code at the first position (`string`), is decimal.
@ -36,6 +32,8 @@ code at the first position (`string`), is decimal.
* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) * [`is-alphabetical`](https://github.com/wooorm/is-alphabetical)
* [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal) * [`is-hexadecimal`](https://github.com/wooorm/is-hexadecimal)
* [`is-whitespace-character`](https://github.com/wooorm/is-whitespace-character)
* [`is-word-character`](https://github.com/wooorm/is-word-character)
## License ## License
@ -51,7 +49,7 @@ code at the first position (`string`), is decimal.
[codecov]: https://codecov.io/github/wooorm/is-decimal [codecov]: https://codecov.io/github/wooorm/is-decimal
[npm-install]: https://docs.npmjs.com/cli/install [npm]: https://docs.npmjs.com/cli/install
[license]: LICENSE [license]: LICENSE

6
tools/eslint/node_modules/is-hexadecimal/history.md

@ -1,6 +0,0 @@
<!--remark setext-->
<!--lint disable no-multiple-toplevel-headings -->
1.0.0 / 2016-07-11
==================

20
tools/eslint/node_modules/is-hexadecimal/index.js

@ -1,25 +1,9 @@
/**
* @author Titus Wormer
* @copyright 2016 Titus Wormer
* @license MIT
* @module is-hexadecimal
* @fileoverview Check if a character is hexadecimal.
*/
'use strict'; 'use strict';
/* eslint-env commonjs */
/* Expose. */
module.exports = hexadecimal; module.exports = hexadecimal;
/** /* Check if the given character code, or the character
* Check whether the given character code, or the character * code at the first character, is hexadecimal. */
* code at the first character, is hexadecimal.
*
* @param {string|number} character
* @return {boolean} - Whether `character` is hexadecimal.
*/
function hexadecimal(character) { function hexadecimal(character) {
var code = typeof character === 'string' ? var code = typeof character === 'string' ?
character.charCodeAt(0) : character; character.charCodeAt(0) : character;

40
tools/eslint/node_modules/is-hexadecimal/package.json

@ -1,8 +1,8 @@
{ {
"_from": "is-hexadecimal@^1.0.0", "_from": "is-hexadecimal@^1.0.0",
"_id": "is-hexadecimal@1.0.0", "_id": "is-hexadecimal@1.0.1",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-XEWXcdKvmi45Ungf1U/LG8/kETw=", "_integrity": "sha1-bghLvJIGH7sJcexYts5tQE4k2mk=",
"_location": "/is-hexadecimal", "_location": "/is-hexadecimal",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -18,8 +18,8 @@
"_requiredBy": [ "_requiredBy": [
"/parse-entities" "/parse-entities"
], ],
"_resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.0.tgz", "_resolved": "https://registry.npmjs.org/is-hexadecimal/-/is-hexadecimal-1.0.1.tgz",
"_shasum": "5c459771d2af9a2e3952781fd54fcb1bcfe4113c", "_shasum": "6e084bbc92061fbb0971ec58b6ce6d404e24da69",
"_spec": "is-hexadecimal@^1.0.0", "_spec": "is-hexadecimal@^1.0.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/parse-entities", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/parse-entities",
"author": { "author": {
@ -42,16 +42,13 @@
"deprecated": false, "deprecated": false,
"description": "Check if a character is hexadecimal", "description": "Check if a character is hexadecimal",
"devDependencies": { "devDependencies": {
"browserify": "^13.0.1", "browserify": "^14.1.0",
"esmangle": "^1.0.1", "esmangle": "^1.0.1",
"nyc": "^7.0.0", "nyc": "^11.0.0",
"remark-cli": "^1.0.0", "remark-cli": "^3.0.0",
"remark-comment-config": "^4.0.0", "remark-preset-wooorm": "^3.0.0",
"remark-github": "^5.0.0",
"remark-lint": "^4.0.0",
"remark-validate-links": "^4.0.0",
"tape": "^4.0.0", "tape": "^4.0.0",
"xo": "^0.16.0" "xo": "^0.18.0"
}, },
"files": [ "files": [
"index.js" "index.js"
@ -73,16 +70,9 @@
"branches": 100 "branches": 100
}, },
"remarkConfig": { "remarkConfig": {
"output": true,
"plugins": [ "plugins": [
"comment-config", "preset-wooorm"
"github", ]
"lint",
"validate-links"
],
"settings": {
"bullet": "*"
}
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -92,18 +82,18 @@
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", "build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js --bare -s isHexadecimal > is-hexadecimal.js", "build-bundle": "browserify index.js --bare -s isHexadecimal > is-hexadecimal.js",
"build-mangle": "esmangle < is-hexadecimal.js > is-hexadecimal.min.js", "build-mangle": "esmangle < is-hexadecimal.js > is-hexadecimal.min.js",
"build-md": "remark . --quiet --frail", "build-md": "remark . -qfo",
"lint": "xo", "lint": "xo",
"test": "npm run build && npm run lint && npm run test-coverage", "test": "npm run build && npm run lint && npm run test-coverage",
"test-api": "node test", "test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js" "test-coverage": "nyc --reporter lcov tape test.js"
}, },
"version": "1.0.0", "version": "1.0.1",
"xo": { "xo": {
"space": true, "space": true,
"esnext": false,
"ignores": [ "ignores": [
"is-hexadecimal.js", "is-hexadecimal.js"
"is-hexadecimal.min.js"
] ]
} }
} }

21
tools/eslint/node_modules/is-hexadecimal/readme.md

@ -1,12 +1,10 @@
# is-hexadecimal [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] # is-hexadecimal [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]
<!--lint disable heading-increment list-item-spacing-->
Check if a character is hexadecimal. Check if a character is hexadecimal.
## Installation ## Installation
[npm][npm-install]: [npm][]:
```bash ```bash
npm install is-hexadecimal npm install is-hexadecimal
@ -14,20 +12,18 @@ npm install is-hexadecimal
## Usage ## Usage
Dependencies:
```javascript ```javascript
var hexadecimal = require('is-hexadecimal'); var hexadecimal = require('is-hexadecimal');
hexadecimal('a'); // true hexadecimal('a'); //=> true
hexadecimal('0'); // true hexadecimal('0'); //=> true
hexadecimal('G'); // false hexadecimal('G'); //=> false
hexadecimal('💩'); // false hexadecimal('💩'); //=> false
``` ```
## API ## API
### `hexadecimal(character)` ### `hexadecimal(character|code)`
Check whether the given character code (`number`), or the character Check whether the given character code (`number`), or the character
code at the first position (`string`), is hexadecimal. code at the first position (`string`), is hexadecimal.
@ -35,7 +31,10 @@ code at the first position (`string`), is hexadecimal.
## Related ## Related
* [`is-alphabetical`](https://github.com/wooorm/is-alphabetical) * [`is-alphabetical`](https://github.com/wooorm/is-alphabetical)
* [`is-alphanumerical`](https://github.com/wooorm/is-alphabetical)
* [`is-decimal`](https://github.com/wooorm/is-decimal) * [`is-decimal`](https://github.com/wooorm/is-decimal)
* [`is-whitespace-character`](https://github.com/wooorm/is-whitespace-character)
* [`is-word-character`](https://github.com/wooorm/is-word-character)
## License ## License
@ -51,7 +50,7 @@ code at the first position (`string`), is hexadecimal.
[codecov]: https://codecov.io/github/wooorm/is-hexadecimal [codecov]: https://codecov.io/github/wooorm/is-hexadecimal
[npm-install]: https://docs.npmjs.com/cli/install [npm]: https://docs.npmjs.com/cli/install
[license]: LICENSE [license]: LICENSE

6
tools/eslint/node_modules/is-whitespace-character/history.md

@ -1,6 +0,0 @@
<!--remark setext-->
<!--lint disable no-multiple-toplevel-headings -->
1.0.0 / 2016-07-12
==================

23
tools/eslint/node_modules/is-whitespace-character/index.js

@ -1,31 +1,12 @@
/**
* @author Titus Wormer
* @copyright 2016 Titus Wormer
* @license MIT
* @module is-whitespace-character
* @fileoverview Check if a character is a whitespace character.
*/
'use strict'; 'use strict';
/* eslint-env commonjs */
/* Expose. */
module.exports = whitespace; module.exports = whitespace;
/* Methods. */
var fromCode = String.fromCharCode; var fromCode = String.fromCharCode;
/* Constants. */
var re = /\s/; var re = /\s/;
/** /* Check if the given character code, or the character
* Check whether the given character code, or the character * code at the first character, is a whitespace character. */
* code at the first character, is a whitespace character.
*
* @param {string|number} character
* @return {boolean} - Whether `character` is a whitespaces character.
*/
function whitespace(character) { function whitespace(character) {
return re.test( return re.test(
typeof character === 'number' ? fromCode(character) : character.charAt(0) typeof character === 'number' ? fromCode(character) : character.charAt(0)

40
tools/eslint/node_modules/is-whitespace-character/package.json

@ -1,8 +1,8 @@
{ {
"_from": "is-whitespace-character@^1.0.0", "_from": "is-whitespace-character@^1.0.0",
"_id": "is-whitespace-character@1.0.0", "_id": "is-whitespace-character@1.0.1",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-u/SoN2Tq0NRRvsKlUhjpGWGtwnU=", "_integrity": "sha1-muAXbzKCtlRXoZks2whPil+DPjs=",
"_location": "/is-whitespace-character", "_location": "/is-whitespace-character",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -18,8 +18,8 @@
"_requiredBy": [ "_requiredBy": [
"/remark-parse" "/remark-parse"
], ],
"_resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.0.tgz", "_resolved": "https://registry.npmjs.org/is-whitespace-character/-/is-whitespace-character-1.0.1.tgz",
"_shasum": "bbf4a83764ead0d451bec2a55218e91961adc275", "_shasum": "9ae0176f3282b65457a1992cdb084f8a5f833e3b",
"_spec": "is-whitespace-character@^1.0.0", "_spec": "is-whitespace-character@^1.0.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/remark-parse", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/remark-parse",
"author": { "author": {
@ -42,16 +42,13 @@
"deprecated": false, "deprecated": false,
"description": "Check if a character is a whitespace character", "description": "Check if a character is a whitespace character",
"devDependencies": { "devDependencies": {
"browserify": "^13.0.1", "browserify": "^14.1.0",
"esmangle": "^1.0.1", "esmangle": "^1.0.1",
"nyc": "^7.0.0", "nyc": "^11.0.0",
"remark-cli": "^1.0.0", "remark-cli": "^3.0.0",
"remark-comment-config": "^4.0.0", "remark-preset-wooorm": "^3.0.0",
"remark-github": "^5.0.0",
"remark-lint": "^4.0.0",
"remark-validate-links": "^4.0.0",
"tape": "^4.0.0", "tape": "^4.0.0",
"xo": "^0.16.0" "xo": "^0.18.0"
}, },
"files": [ "files": [
"index.js" "index.js"
@ -75,16 +72,9 @@
"branches": 100 "branches": 100
}, },
"remarkConfig": { "remarkConfig": {
"output": true,
"plugins": [ "plugins": [
"comment-config", "preset-wooorm"
"github", ]
"lint",
"validate-links"
],
"settings": {
"bullet": "*"
}
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -94,18 +84,18 @@
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", "build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js --bare -s isWhitespaceCharacter > is-whitespace-character.js", "build-bundle": "browserify index.js --bare -s isWhitespaceCharacter > is-whitespace-character.js",
"build-mangle": "esmangle < is-whitespace-character.js > is-whitespace-character.min.js", "build-mangle": "esmangle < is-whitespace-character.js > is-whitespace-character.min.js",
"build-md": "remark . --quiet --frail", "build-md": "remark . -qfo",
"lint": "xo", "lint": "xo",
"test": "npm run build && npm run lint && npm run test-coverage", "test": "npm run build && npm run lint && npm run test-coverage",
"test-api": "node test", "test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js" "test-coverage": "nyc --reporter lcov tape test.js"
}, },
"version": "1.0.0", "version": "1.0.1",
"xo": { "xo": {
"space": true, "space": true,
"esnext": false,
"ignores": [ "ignores": [
"is-whitespace-character.js", "is-whitespace-character.js"
"is-whitespace-character.min.js"
] ]
} }
} }

8
tools/eslint/node_modules/is-whitespace-character/readme.md

@ -1,14 +1,12 @@
# is-whitespace-character [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] # is-whitespace-character [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]
<!--lint disable heading-increment list-item-spacing-->
Check if a character is a whitespace character: `\s`, which equals Check if a character is a whitespace character: `\s`, which equals
all Unicode Space Separators (including `[ \t\v\f]`), the BOM all Unicode Space Separators (including `[ \t\v\f]`), the BOM
(`\uFEFF`), and line terminator (`[\n\r\u2028\u2029]`). (`\uFEFF`), and line terminator (`[\n\r\u2028\u2029]`).
## Installation ## Installation
[npm][npm-install]: [npm][]:
```bash ```bash
npm install is-whitespace-character npm install is-whitespace-character
@ -29,7 +27,7 @@ whitespace('💩'); // false
## API ## API
### `whitespaceCharacter(character)` ### `whitespaceCharacter(character|code)`
Check whether the given character code (`number`), or the character Check whether the given character code (`number`), or the character
code at the first position (`string`), is a whitespace character. code at the first position (`string`), is a whitespace character.
@ -56,7 +54,7 @@ code at the first position (`string`), is a whitespace character.
[codecov]: https://codecov.io/github/wooorm/is-whitespace-character [codecov]: https://codecov.io/github/wooorm/is-whitespace-character
[npm-install]: https://docs.npmjs.com/cli/install [npm]: https://docs.npmjs.com/cli/install
[license]: LICENSE [license]: LICENSE

6
tools/eslint/node_modules/is-word-character/history.md

@ -1,6 +0,0 @@
<!--remark setext-->
<!--lint disable no-multiple-toplevel-headings -->
1.0.0 / 2016-07-12
==================

23
tools/eslint/node_modules/is-word-character/index.js

@ -1,31 +1,12 @@
/**
* @author Titus Wormer
* @copyright 2016 Titus Wormer
* @license MIT
* @module is-word-character
* @fileoverview Check if a character is a word character.
*/
'use strict'; 'use strict';
/* eslint-env commonjs */
/* Expose. */
module.exports = wordCharacter; module.exports = wordCharacter;
/* Methods. */
var fromCode = String.fromCharCode; var fromCode = String.fromCharCode;
/* Constants. */
var re = /\w/; var re = /\w/;
/** /* Check if the given character code, or the character
* Check whether the given character code, or the character * code at the first character, is a word character. */
* code at the first character, is a word character.
*
* @param {string|number} character
* @return {boolean} - Whether `character` is a word character.
*/
function wordCharacter(character) { function wordCharacter(character) {
return re.test( return re.test(
typeof character === 'number' ? fromCode(character) : character.charAt(0) typeof character === 'number' ? fromCode(character) : character.charAt(0)

40
tools/eslint/node_modules/is-word-character/package.json

@ -1,8 +1,8 @@
{ {
"_from": "is-word-character@^1.0.0", "_from": "is-word-character@^1.0.0",
"_id": "is-word-character@1.0.0", "_id": "is-word-character@1.0.1",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-o6nl3a1wxcLuNvSpz8mlP0RTUkc=", "_integrity": "sha1-WgP6HqkazopusMfNdw64bWXIvvs=",
"_location": "/is-word-character", "_location": "/is-word-character",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -18,8 +18,8 @@
"_requiredBy": [ "_requiredBy": [
"/remark-parse" "/remark-parse"
], ],
"_resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.0.tgz", "_resolved": "https://registry.npmjs.org/is-word-character/-/is-word-character-1.0.1.tgz",
"_shasum": "a3a9e5ddad70c5c2ee36f4a9cfc9a53f44535247", "_shasum": "5a03fa1ea91ace8a6eb0c7cd770eb86d65c8befb",
"_spec": "is-word-character@^1.0.0", "_spec": "is-word-character@^1.0.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/remark-parse", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/remark-parse",
"author": { "author": {
@ -42,16 +42,13 @@
"deprecated": false, "deprecated": false,
"description": "Check if a character is a word character", "description": "Check if a character is a word character",
"devDependencies": { "devDependencies": {
"browserify": "^13.0.1", "browserify": "^14.1.0",
"esmangle": "^1.0.1", "esmangle": "^1.0.1",
"nyc": "^7.0.0", "nyc": "^11.0.0",
"remark-cli": "^1.0.0", "remark-cli": "^3.0.0",
"remark-comment-config": "^4.0.0", "remark-preset-wooorm": "^3.0.0",
"remark-github": "^5.0.0",
"remark-lint": "^4.0.0",
"remark-validate-links": "^4.0.0",
"tape": "^4.0.0", "tape": "^4.0.0",
"xo": "^0.16.0" "xo": "^0.18.0"
}, },
"files": [ "files": [
"index.js" "index.js"
@ -73,16 +70,9 @@
"branches": 100 "branches": 100
}, },
"remarkConfig": { "remarkConfig": {
"output": true,
"plugins": [ "plugins": [
"comment-config", "preset-wooorm"
"github", ]
"lint",
"validate-links"
],
"settings": {
"bullet": "*"
}
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -92,18 +82,18 @@
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", "build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js --bare -s isWordCharacter > is-word-character.js", "build-bundle": "browserify index.js --bare -s isWordCharacter > is-word-character.js",
"build-mangle": "esmangle < is-word-character.js > is-word-character.min.js", "build-mangle": "esmangle < is-word-character.js > is-word-character.min.js",
"build-md": "remark . --quiet --frail", "build-md": "remark . -qfo",
"lint": "xo", "lint": "xo",
"test": "npm run build && npm run lint && npm run test-coverage", "test": "npm run build && npm run lint && npm run test-coverage",
"test-api": "node test", "test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js" "test-coverage": "nyc --reporter lcov tape test.js"
}, },
"version": "1.0.0", "version": "1.0.1",
"xo": { "xo": {
"space": true, "space": true,
"esnext": false,
"ignores": [ "ignores": [
"is-word-character.js", "is-word-character.js"
"is-word-character.min.js"
] ]
} }
} }

20
tools/eslint/node_modules/is-word-character/readme.md

@ -1,13 +1,11 @@
# is-word-character [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] # is-word-character [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]
<!--lint disable heading-increment list-item-spacing-->
Check if a character is a word character (`\w`, which equals Check if a character is a word character (`\w`, which equals
`[a-zA-Z0-9_]`). `[a-zA-Z0-9_]`).
## Installation ## Installation
[npm][npm-install]: [npm][]:
```bash ```bash
npm install is-word-character npm install is-word-character
@ -18,17 +16,17 @@ npm install is-word-character
```javascript ```javascript
var wordCharacter = require('is-word-character'); var wordCharacter = require('is-word-character');
wordCharacter('a'); // true wordCharacter('a'); //=> true
wordCharacter('Z'); // true wordCharacter('Z'); //=> true
wordCharacter('0'); // true wordCharacter('0'); //=> true
wordCharacter('_'); // true wordCharacter('_'); //=> true
wordCharacter(' '); // false wordCharacter(' '); //=> false
wordCharacter('💩'); // false wordCharacter('💩'); //=> false
``` ```
## API ## API
### `wordCharacter(character)` ### `wordCharacter(character|code)`
Check whether the given character code (`number`), or the character Check whether the given character code (`number`), or the character
code at the first position (`string`), is a word character. code at the first position (`string`), is a word character.
@ -55,7 +53,7 @@ code at the first position (`string`), is a word character.
[codecov]: https://codecov.io/github/wooorm/is-word-character [codecov]: https://codecov.io/github/wooorm/is-word-character
[npm-install]: https://docs.npmjs.com/cli/install [npm]: https://docs.npmjs.com/cli/install
[license]: LICENSE [license]: LICENSE

15
tools/eslint/node_modules/isexe/LICENSE

@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

51
tools/eslint/node_modules/isexe/README.md

@ -0,0 +1,51 @@
# isexe
Minimal module to check if a file is executable, and a normal file.
Uses `fs.stat` and tests against the `PATHEXT` environment variable on
Windows.
## USAGE
```javascript
var isexe = require('isexe')
isexe('some-file-name', function (err, isExe) {
if (err) {
console.error('probably file does not exist or something', err)
} else if (isExe) {
console.error('this thing can be run')
} else {
console.error('cannot be run')
}
})
// same thing but synchronous, throws errors
var isExe = isexe.sync('some-file-name')
// treat errors as just "not executable"
isexe('maybe-missing-file', { ignoreErrors: true }, callback)
var isExe = isexe.sync('maybe-missing-file', { ignoreErrors: true })
```
## API
### `isexe(path, [options], [callback])`
Check if the path is executable. If no callback provided, and a
global `Promise` object is available, then a Promise will be returned.
Will raise whatever errors may be raised by `fs.stat`, unless
`options.ignoreErrors` is set to true.
### `isexe.sync(path, [options])`
Same as `isexe` but returns the value and throws any errors raised.
### Options
* `ignoreErrors` Treat all errors as "no, this is not executable", but
don't raise them.
* `uid` Number to use as the user id
* `gid` Number to use as the group id
* `pathExt` List of path extensions to use instead of `PATHEXT`
environment variable on Windows.

57
tools/eslint/node_modules/isexe/index.js

@ -0,0 +1,57 @@
var fs = require('fs')
var core
if (process.platform === 'win32' || global.TESTING_WINDOWS) {
core = require('./windows.js')
} else {
core = require('./mode.js')
}
module.exports = isexe
isexe.sync = sync
function isexe (path, options, cb) {
if (typeof options === 'function') {
cb = options
options = {}
}
if (!cb) {
if (typeof Promise !== 'function') {
throw new TypeError('callback not provided')
}
return new Promise(function (resolve, reject) {
isexe(path, options || {}, function (er, is) {
if (er) {
reject(er)
} else {
resolve(is)
}
})
})
}
core(path, options || {}, function (er, is) {
// ignore EACCES because that just means we aren't allowed to run it
if (er) {
if (er.code === 'EACCES' || options && options.ignoreErrors) {
er = null
is = false
}
}
cb(er, is)
})
}
function sync (path, options) {
// my kingdom for a filtered catch
try {
return core.sync(path, options || {})
} catch (er) {
if (options && options.ignoreErrors || er.code === 'EACCES') {
return false
} else {
throw er
}
}
}

41
tools/eslint/node_modules/isexe/mode.js

@ -0,0 +1,41 @@
module.exports = isexe
isexe.sync = sync
var fs = require('fs')
function isexe (path, options, cb) {
fs.stat(path, function (er, stat) {
cb(er, er ? false : checkStat(stat, options))
})
}
function sync (path, options) {
return checkStat(fs.statSync(path), options)
}
function checkStat (stat, options) {
return stat.isFile() && checkMode(stat, options)
}
function checkMode (stat, options) {
var mod = stat.mode
var uid = stat.uid
var gid = stat.gid
var myUid = options.uid !== undefined ?
options.uid : process.getuid && process.getuid()
var myGid = options.gid !== undefined ?
options.gid : process.getgid && process.getgid()
var u = parseInt('100', 8)
var g = parseInt('010', 8)
var o = parseInt('001', 8)
var ug = u | g
var ret = (mod & o) ||
(mod & g) && gid === myGid ||
(mod & u) && uid === myUid ||
(mod & ug) && myUid === 0
return ret
}

60
tools/eslint/node_modules/isexe/package.json

@ -0,0 +1,60 @@
{
"_from": "isexe@^2.0.0",
"_id": "isexe@2.0.0",
"_inBundle": false,
"_integrity": "sha1-6PvzdNxVb/iUehDcsFctYz8s+hA=",
"_location": "/eslint/isexe",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "isexe@^2.0.0",
"name": "isexe",
"escapedName": "isexe",
"rawSpec": "^2.0.0",
"saveSpec": null,
"fetchSpec": "^2.0.0"
},
"_requiredBy": [
"/eslint/which"
],
"_resolved": "https://registry.npmjs.org/isexe/-/isexe-2.0.0.tgz",
"_shasum": "e8fbf374dc556ff8947a10dcb0572d633f2cfa10",
"_spec": "isexe@^2.0.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/which",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bugs": {
"url": "https://github.com/isaacs/isexe/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "Minimal module to check if a file is executable.",
"devDependencies": {
"mkdirp": "^0.5.1",
"rimraf": "^2.5.0",
"tap": "^10.3.0"
},
"directories": {
"test": "test"
},
"homepage": "https://github.com/isaacs/isexe#readme",
"keywords": [],
"license": "ISC",
"main": "index.js",
"name": "isexe",
"repository": {
"type": "git",
"url": "git+https://github.com/isaacs/isexe.git"
},
"scripts": {
"postpublish": "git push origin --all; git push origin --tags",
"postversion": "npm publish",
"preversion": "npm test",
"test": "tap test/*.js --100"
},
"version": "2.0.0"
}

42
tools/eslint/node_modules/isexe/windows.js

@ -0,0 +1,42 @@
module.exports = isexe
isexe.sync = sync
var fs = require('fs')
function checkPathExt (path, options) {
var pathext = options.pathExt !== undefined ?
options.pathExt : process.env.PATHEXT
if (!pathext) {
return true
}
pathext = pathext.split(';')
if (pathext.indexOf('') !== -1) {
return true
}
for (var i = 0; i < pathext.length; i++) {
var p = pathext[i].toLowerCase()
if (p && path.substr(-p.length).toLowerCase() === p) {
return true
}
}
return false
}
function checkStat (stat, path, options) {
if (!stat.isSymbolicLink() && !stat.isFile()) {
return false
}
return checkPathExt(path, options)
}
function isexe (path, options, cb) {
fs.stat(path, function (er, stat) {
cb(er, er ? false : checkStat(stat, path, options))
})
}
function sync (path, options) {
return checkStat(fs.statSync(path), path, options)
}

504
tools/eslint/node_modules/jschardet/LICENSE

@ -0,0 +1,504 @@
GNU LESSER GENERAL PUBLIC LICENSE
Version 2.1, February 1999
Copyright (C) 1991, 1999 Free Software Foundation, Inc.
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA
Everyone is permitted to copy and distribute verbatim copies
of this license document, but changing it is not allowed.
(This is the first released version of the Lesser GPL. It also counts
as the successor of the GNU Library Public License, version 2, hence
the version number 2.1.)
Preamble
The licenses for most software are designed to take away your
freedom to share and change it. By contrast, the GNU General Public
Licenses are intended to guarantee your freedom to share and change
free software--to make sure the software is free for all its users.
This license, the Lesser General Public License, applies to some
specially designated software packages--typically libraries--of the
Free Software Foundation and other authors who decide to use it. You
can use it too, but we suggest you first think carefully about whether
this license or the ordinary General Public License is the better
strategy to use in any particular case, based on the explanations below.
When we speak of free software, we are referring to freedom of use,
not price. Our General Public Licenses are designed to make sure that
you have the freedom to distribute copies of free software (and charge
for this service if you wish); that you receive source code or can get
it if you want it; that you can change the software and use pieces of
it in new free programs; and that you are informed that you can do
these things.
To protect your rights, we need to make restrictions that forbid
distributors to deny you these rights or to ask you to surrender these
rights. These restrictions translate to certain responsibilities for
you if you distribute copies of the library or if you modify it.
For example, if you distribute copies of the library, whether gratis
or for a fee, you must give the recipients all the rights that we gave
you. You must make sure that they, too, receive or can get the source
code. If you link other code with the library, you must provide
complete object files to the recipients, so that they can relink them
with the library after making changes to the library and recompiling
it. And you must show them these terms so they know their rights.
We protect your rights with a two-step method: (1) we copyright the
library, and (2) we offer you this license, which gives you legal
permission to copy, distribute and/or modify the library.
To protect each distributor, we want to make it very clear that
there is no warranty for the free library. Also, if the library is
modified by someone else and passed on, the recipients should know
that what they have is not the original version, so that the original
author's reputation will not be affected by problems that might be
introduced by others.
Finally, software patents pose a constant threat to the existence of
any free program. We wish to make sure that a company cannot
effectively restrict the users of a free program by obtaining a
restrictive license from a patent holder. Therefore, we insist that
any patent license obtained for a version of the library must be
consistent with the full freedom of use specified in this license.
Most GNU software, including some libraries, is covered by the
ordinary GNU General Public License. This license, the GNU Lesser
General Public License, applies to certain designated libraries, and
is quite different from the ordinary General Public License. We use
this license for certain libraries in order to permit linking those
libraries into non-free programs.
When a program is linked with a library, whether statically or using
a shared library, the combination of the two is legally speaking a
combined work, a derivative of the original library. The ordinary
General Public License therefore permits such linking only if the
entire combination fits its criteria of freedom. The Lesser General
Public License permits more lax criteria for linking other code with
the library.
We call this license the "Lesser" General Public License because it
does Less to protect the user's freedom than the ordinary General
Public License. It also provides other free software developers Less
of an advantage over competing non-free programs. These disadvantages
are the reason we use the ordinary General Public License for many
libraries. However, the Lesser license provides advantages in certain
special circumstances.
For example, on rare occasions, there may be a special need to
encourage the widest possible use of a certain library, so that it becomes
a de-facto standard. To achieve this, non-free programs must be
allowed to use the library. A more frequent case is that a free
library does the same job as widely used non-free libraries. In this
case, there is little to gain by limiting the free library to free
software only, so we use the Lesser General Public License.
In other cases, permission to use a particular library in non-free
programs enables a greater number of people to use a large body of
free software. For example, permission to use the GNU C Library in
non-free programs enables many more people to use the whole GNU
operating system, as well as its variant, the GNU/Linux operating
system.
Although the Lesser General Public License is Less protective of the
users' freedom, it does ensure that the user of a program that is
linked with the Library has the freedom and the wherewithal to run
that program using a modified version of the Library.
The precise terms and conditions for copying, distribution and
modification follow. Pay close attention to the difference between a
"work based on the library" and a "work that uses the library". The
former contains code derived from the library, whereas the latter must
be combined with the library in order to run.
GNU LESSER GENERAL PUBLIC LICENSE
TERMS AND CONDITIONS FOR COPYING, DISTRIBUTION AND MODIFICATION
0. This License Agreement applies to any software library or other
program which contains a notice placed by the copyright holder or
other authorized party saying it may be distributed under the terms of
this Lesser General Public License (also called "this License").
Each licensee is addressed as "you".
A "library" means a collection of software functions and/or data
prepared so as to be conveniently linked with application programs
(which use some of those functions and data) to form executables.
The "Library", below, refers to any such software library or work
which has been distributed under these terms. A "work based on the
Library" means either the Library or any derivative work under
copyright law: that is to say, a work containing the Library or a
portion of it, either verbatim or with modifications and/or translated
straightforwardly into another language. (Hereinafter, translation is
included without limitation in the term "modification".)
"Source code" for a work means the preferred form of the work for
making modifications to it. For a library, complete source code means
all the source code for all modules it contains, plus any associated
interface definition files, plus the scripts used to control compilation
and installation of the library.
Activities other than copying, distribution and modification are not
covered by this License; they are outside its scope. The act of
running a program using the Library is not restricted, and output from
such a program is covered only if its contents constitute a work based
on the Library (independent of the use of the Library in a tool for
writing it). Whether that is true depends on what the Library does
and what the program that uses the Library does.
1. You may copy and distribute verbatim copies of the Library's
complete source code as you receive it, in any medium, provided that
you conspicuously and appropriately publish on each copy an
appropriate copyright notice and disclaimer of warranty; keep intact
all the notices that refer to this License and to the absence of any
warranty; and distribute a copy of this License along with the
Library.
You may charge a fee for the physical act of transferring a copy,
and you may at your option offer warranty protection in exchange for a
fee.
2. You may modify your copy or copies of the Library or any portion
of it, thus forming a work based on the Library, and copy and
distribute such modifications or work under the terms of Section 1
above, provided that you also meet all of these conditions:
a) The modified work must itself be a software library.
b) You must cause the files modified to carry prominent notices
stating that you changed the files and the date of any change.
c) You must cause the whole of the work to be licensed at no
charge to all third parties under the terms of this License.
d) If a facility in the modified Library refers to a function or a
table of data to be supplied by an application program that uses
the facility, other than as an argument passed when the facility
is invoked, then you must make a good faith effort to ensure that,
in the event an application does not supply such function or
table, the facility still operates, and performs whatever part of
its purpose remains meaningful.
(For example, a function in a library to compute square roots has
a purpose that is entirely well-defined independent of the
application. Therefore, Subsection 2d requires that any
application-supplied function or table used by this function must
be optional: if the application does not supply it, the square
root function must still compute square roots.)
These requirements apply to the modified work as a whole. If
identifiable sections of that work are not derived from the Library,
and can be reasonably considered independent and separate works in
themselves, then this License, and its terms, do not apply to those
sections when you distribute them as separate works. But when you
distribute the same sections as part of a whole which is a work based
on the Library, the distribution of the whole must be on the terms of
this License, whose permissions for other licensees extend to the
entire whole, and thus to each and every part regardless of who wrote
it.
Thus, it is not the intent of this section to claim rights or contest
your rights to work written entirely by you; rather, the intent is to
exercise the right to control the distribution of derivative or
collective works based on the Library.
In addition, mere aggregation of another work not based on the Library
with the Library (or with a work based on the Library) on a volume of
a storage or distribution medium does not bring the other work under
the scope of this License.
3. You may opt to apply the terms of the ordinary GNU General Public
License instead of this License to a given copy of the Library. To do
this, you must alter all the notices that refer to this License, so
that they refer to the ordinary GNU General Public License, version 2,
instead of to this License. (If a newer version than version 2 of the
ordinary GNU General Public License has appeared, then you can specify
that version instead if you wish.) Do not make any other change in
these notices.
Once this change is made in a given copy, it is irreversible for
that copy, so the ordinary GNU General Public License applies to all
subsequent copies and derivative works made from that copy.
This option is useful when you wish to copy part of the code of
the Library into a program that is not a library.
4. You may copy and distribute the Library (or a portion or
derivative of it, under Section 2) in object code or executable form
under the terms of Sections 1 and 2 above provided that you accompany
it with the complete corresponding machine-readable source code, which
must be distributed under the terms of Sections 1 and 2 above on a
medium customarily used for software interchange.
If distribution of object code is made by offering access to copy
from a designated place, then offering equivalent access to copy the
source code from the same place satisfies the requirement to
distribute the source code, even though third parties are not
compelled to copy the source along with the object code.
5. A program that contains no derivative of any portion of the
Library, but is designed to work with the Library by being compiled or
linked with it, is called a "work that uses the Library". Such a
work, in isolation, is not a derivative work of the Library, and
therefore falls outside the scope of this License.
However, linking a "work that uses the Library" with the Library
creates an executable that is a derivative of the Library (because it
contains portions of the Library), rather than a "work that uses the
library". The executable is therefore covered by this License.
Section 6 states terms for distribution of such executables.
When a "work that uses the Library" uses material from a header file
that is part of the Library, the object code for the work may be a
derivative work of the Library even though the source code is not.
Whether this is true is especially significant if the work can be
linked without the Library, or if the work is itself a library. The
threshold for this to be true is not precisely defined by law.
If such an object file uses only numerical parameters, data
structure layouts and accessors, and small macros and small inline
functions (ten lines or less in length), then the use of the object
file is unrestricted, regardless of whether it is legally a derivative
work. (Executables containing this object code plus portions of the
Library will still fall under Section 6.)
Otherwise, if the work is a derivative of the Library, you may
distribute the object code for the work under the terms of Section 6.
Any executables containing that work also fall under Section 6,
whether or not they are linked directly with the Library itself.
6. As an exception to the Sections above, you may also combine or
link a "work that uses the Library" with the Library to produce a
work containing portions of the Library, and distribute that work
under terms of your choice, provided that the terms permit
modification of the work for the customer's own use and reverse
engineering for debugging such modifications.
You must give prominent notice with each copy of the work that the
Library is used in it and that the Library and its use are covered by
this License. You must supply a copy of this License. If the work
during execution displays copyright notices, you must include the
copyright notice for the Library among them, as well as a reference
directing the user to the copy of this License. Also, you must do one
of these things:
a) Accompany the work with the complete corresponding
machine-readable source code for the Library including whatever
changes were used in the work (which must be distributed under
Sections 1 and 2 above); and, if the work is an executable linked
with the Library, with the complete machine-readable "work that
uses the Library", as object code and/or source code, so that the
user can modify the Library and then relink to produce a modified
executable containing the modified Library. (It is understood
that the user who changes the contents of definitions files in the
Library will not necessarily be able to recompile the application
to use the modified definitions.)
b) Use a suitable shared library mechanism for linking with the
Library. A suitable mechanism is one that (1) uses at run time a
copy of the library already present on the user's computer system,
rather than copying library functions into the executable, and (2)
will operate properly with a modified version of the library, if
the user installs one, as long as the modified version is
interface-compatible with the version that the work was made with.
c) Accompany the work with a written offer, valid for at
least three years, to give the same user the materials
specified in Subsection 6a, above, for a charge no more
than the cost of performing this distribution.
d) If distribution of the work is made by offering access to copy
from a designated place, offer equivalent access to copy the above
specified materials from the same place.
e) Verify that the user has already received a copy of these
materials or that you have already sent this user a copy.
For an executable, the required form of the "work that uses the
Library" must include any data and utility programs needed for
reproducing the executable from it. However, as a special exception,
the materials to be distributed need not include anything that is
normally distributed (in either source or binary form) with the major
components (compiler, kernel, and so on) of the operating system on
which the executable runs, unless that component itself accompanies
the executable.
It may happen that this requirement contradicts the license
restrictions of other proprietary libraries that do not normally
accompany the operating system. Such a contradiction means you cannot
use both them and the Library together in an executable that you
distribute.
7. You may place library facilities that are a work based on the
Library side-by-side in a single library together with other library
facilities not covered by this License, and distribute such a combined
library, provided that the separate distribution of the work based on
the Library and of the other library facilities is otherwise
permitted, and provided that you do these two things:
a) Accompany the combined library with a copy of the same work
based on the Library, uncombined with any other library
facilities. This must be distributed under the terms of the
Sections above.
b) Give prominent notice with the combined library of the fact
that part of it is a work based on the Library, and explaining
where to find the accompanying uncombined form of the same work.
8. You may not copy, modify, sublicense, link with, or distribute
the Library except as expressly provided under this License. Any
attempt otherwise to copy, modify, sublicense, link with, or
distribute the Library is void, and will automatically terminate your
rights under this License. However, parties who have received copies,
or rights, from you under this License will not have their licenses
terminated so long as such parties remain in full compliance.
9. You are not required to accept this License, since you have not
signed it. However, nothing else grants you permission to modify or
distribute the Library or its derivative works. These actions are
prohibited by law if you do not accept this License. Therefore, by
modifying or distributing the Library (or any work based on the
Library), you indicate your acceptance of this License to do so, and
all its terms and conditions for copying, distributing or modifying
the Library or works based on it.
10. Each time you redistribute the Library (or any work based on the
Library), the recipient automatically receives a license from the
original licensor to copy, distribute, link with or modify the Library
subject to these terms and conditions. You may not impose any further
restrictions on the recipients' exercise of the rights granted herein.
You are not responsible for enforcing compliance by third parties with
this License.
11. If, as a consequence of a court judgment or allegation of patent
infringement or for any other reason (not limited to patent issues),
conditions are imposed on you (whether by court order, agreement or
otherwise) that contradict the conditions of this License, they do not
excuse you from the conditions of this License. If you cannot
distribute so as to satisfy simultaneously your obligations under this
License and any other pertinent obligations, then as a consequence you
may not distribute the Library at all. For example, if a patent
license would not permit royalty-free redistribution of the Library by
all those who receive copies directly or indirectly through you, then
the only way you could satisfy both it and this License would be to
refrain entirely from distribution of the Library.
If any portion of this section is held invalid or unenforceable under any
particular circumstance, the balance of the section is intended to apply,
and the section as a whole is intended to apply in other circumstances.
It is not the purpose of this section to induce you to infringe any
patents or other property right claims or to contest validity of any
such claims; this section has the sole purpose of protecting the
integrity of the free software distribution system which is
implemented by public license practices. Many people have made
generous contributions to the wide range of software distributed
through that system in reliance on consistent application of that
system; it is up to the author/donor to decide if he or she is willing
to distribute software through any other system and a licensee cannot
impose that choice.
This section is intended to make thoroughly clear what is believed to
be a consequence of the rest of this License.
12. If the distribution and/or use of the Library is restricted in
certain countries either by patents or by copyrighted interfaces, the
original copyright holder who places the Library under this License may add
an explicit geographical distribution limitation excluding those countries,
so that distribution is permitted only in or among countries not thus
excluded. In such case, this License incorporates the limitation as if
written in the body of this License.
13. The Free Software Foundation may publish revised and/or new
versions of the Lesser General Public License from time to time.
Such new versions will be similar in spirit to the present version,
but may differ in detail to address new problems or concerns.
Each version is given a distinguishing version number. If the Library
specifies a version number of this License which applies to it and
"any later version", you have the option of following the terms and
conditions either of that version or of any later version published by
the Free Software Foundation. If the Library does not specify a
license version number, you may choose any version ever published by
the Free Software Foundation.
14. If you wish to incorporate parts of the Library into other free
programs whose distribution conditions are incompatible with these,
write to the author to ask for permission. For software which is
copyrighted by the Free Software Foundation, write to the Free
Software Foundation; we sometimes make exceptions for this. Our
decision will be guided by the two goals of preserving the free status
of all derivatives of our free software and of promoting the sharing
and reuse of software generally.
NO WARRANTY
15. BECAUSE THE LIBRARY IS LICENSED FREE OF CHARGE, THERE IS NO
WARRANTY FOR THE LIBRARY, TO THE EXTENT PERMITTED BY APPLICABLE LAW.
EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR
OTHER PARTIES PROVIDE THE LIBRARY "AS IS" WITHOUT WARRANTY OF ANY
KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE
IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR
PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE
LIBRARY IS WITH YOU. SHOULD THE LIBRARY PROVE DEFECTIVE, YOU ASSUME
THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION.
16. IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN
WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MAY MODIFY
AND/OR REDISTRIBUTE THE LIBRARY AS PERMITTED ABOVE, BE LIABLE TO YOU
FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR
CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE
LIBRARY (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING
RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A
FAILURE OF THE LIBRARY TO OPERATE WITH ANY OTHER SOFTWARE), EVEN IF
SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH
DAMAGES.
END OF TERMS AND CONDITIONS
How to Apply These Terms to Your New Libraries
If you develop a new library, and you want it to be of the greatest
possible use to the public, we recommend making it free software that
everyone can redistribute and change. You can do so by permitting
redistribution under these terms (or, alternatively, under the terms of the
ordinary General Public License).
To apply these terms, attach the following notices to the library. It is
safest to attach them to the start of each source file to most effectively
convey the exclusion of warranty; and each file should have at least the
"copyright" line and a pointer to where the full notice is found.
{description}
Copyright (C) {year} {fullname}
This library is free software; you can redistribute it and/or
modify it under the terms of the GNU Lesser General Public
License as published by the Free Software Foundation; either
version 2.1 of the License, or (at your option) any later version.
This library is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
Lesser General Public License for more details.
You should have received a copy of the GNU Lesser General Public
License along with this library; if not, write to the Free Software
Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301
USA
Also add information on how to contact you by electronic and paper mail.
You should also get your employer (if you work as a programmer) or your
school, if any, to sign a "copyright disclaimer" for the library, if
necessary. Here is a sample; alter the names:
Yoyodyne, Inc., hereby disclaims all copyright interest in the
library `Frob' (a library for tweaking knobs) written by James Random
Hacker.
{signature of Ty Coon}, 1 April 1990
Ty Coon, President of Vice
That's all there is to it!

101
tools/eslint/node_modules/jschardet/dist/jschardet.js

@ -1,6 +1,17 @@
(function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jschardet = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){ (function(f){if(typeof exports==="object"&&typeof module!=="undefined"){module.exports=f()}else if(typeof define==="function"&&define.amd){define([],f)}else{var g;if(typeof window!=="undefined"){g=window}else if(typeof global!=="undefined"){g=global}else if(typeof self!=="undefined"){g=self}else{g=this}g.jschardet = f()}})(function(){var define,module,exports;return (function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s})({1:[function(require,module,exports){
module.exports = require('./src') module.exports = require('./src');
},{"./src":19}],2:[function(require,module,exports){
var jschardet = require('./src');
var fs = require('fs');
jschardet.Constants._debug = true;
var contents = fs.readFileSync('./shift-jis_fail.txt');
console.log(jschardet.detect(contents));
},{"./src":20,"fs":2}],2:[function(require,module,exports){
},{}],3:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -931,7 +942,7 @@ jschardet.Big5CharToFreqOrder = [
}(require('./init')); }(require('./init'));
},{"./init":20}],3:[function(require,module,exports){ },{"./init":21}],4:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -984,7 +995,7 @@ jschardet.Big5Prober.prototype = new jschardet.MultiByteCharSetProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],4:[function(require,module,exports){ },{"./init":21}],5:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -1020,6 +1031,8 @@ jschardet.CharDistributionAnalysis = function() {
var ENOUGH_DATA_THRESHOLD = 1024; var ENOUGH_DATA_THRESHOLD = 1024;
var SURE_YES = 0.99; var SURE_YES = 0.99;
var SURE_NO = 0.01; var SURE_NO = 0.01;
var MINIMUM_DATA_THRESHOLD = 3;
var self = this; var self = this;
function init() { function init() {
@ -1064,7 +1077,7 @@ jschardet.CharDistributionAnalysis = function() {
*/ */
this.getConfidence = function() { this.getConfidence = function() {
// if we didn't receive any character in our consideration range, return negative answer // if we didn't receive any character in our consideration range, return negative answer
if( this._mTotalChars <= 0 ) { if( this._mTotalChars <= 0 || this._mFreqChars <= MINIMUM_DATA_THRESHOLD) {
return SURE_NO; return SURE_NO;
} }
if( this._mTotalChars != this._mFreqChars ) { if( this._mTotalChars != this._mFreqChars ) {
@ -1219,8 +1232,8 @@ jschardet.SJISDistributionAnalysis = function() {
this.getOrder = function(aStr) { this.getOrder = function(aStr) {
// for sjis encoding, we are interested // for sjis encoding, we are interested
// first byte range: 0x81 -- 0x9f , 0xe0 -- 0xfe // first byte range: 0x81 -- 0x9f , 0xe0 -- 0xef
// second byte range: 0x40 -- 0x7e, 0x81 -- 0xfe // second byte range: 0x40 -- 0x7e, 0x80 -- 0xfc
// no validation needed here. State machine has done that // no validation needed here. State machine has done that
if( aStr.charCodeAt(0) >= 0x81 && aStr.charCodeAt(0) <= 0x9F ) { if( aStr.charCodeAt(0) >= 0x81 && aStr.charCodeAt(0) <= 0x9F ) {
var order = 188 * (aStr.charCodeAt(0) - 0x81); var order = 188 * (aStr.charCodeAt(0) - 0x81);
@ -1230,7 +1243,7 @@ jschardet.SJISDistributionAnalysis = function() {
return -1; return -1;
} }
order += aStr.charCodeAt(1) - 0x40; order += aStr.charCodeAt(1) - 0x40;
if( aStr.charCodeAt(1) > 0x7F ) { if( aStr.charCodeAt(1) < 0x40 || aStr.charCodeAt(1) === 0x7F || aStr.charCodeAt(1) > 0xFC) {
order = -1; order = -1;
} }
return order; return order;
@ -1269,7 +1282,7 @@ jschardet.EUCJPDistributionAnalysis.prototype = new jschardet.CharDistributionAn
}(require('./init')); }(require('./init'));
},{"./init":20}],5:[function(require,module,exports){ },{"./init":21}],6:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -1389,7 +1402,7 @@ jschardet.CharSetGroupProber.prototype = new jschardet.CharSetProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],6:[function(require,module,exports){ },{"./init":21}],7:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -1459,7 +1472,7 @@ jschardet.CharSetProber = function() {
}(require('./init')); }(require('./init'));
},{"./init":20}],7:[function(require,module,exports){ },{"./init":21}],8:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -1532,7 +1545,7 @@ jschardet.CodingStateMachine = function(sm) {
}(require('./init')); }(require('./init'));
},{"./init":20}],8:[function(require,module,exports){ },{"./init":21}],9:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -1581,7 +1594,7 @@ jschardet.Constants = {
}(require('./init')); }(require('./init'));
},{"./init":20}],9:[function(require,module,exports){ },{"./init":21}],10:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -1681,7 +1694,7 @@ jschardet.EscCharSetProber.prototype = new jschardet.CharSetProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],10:[function(require,module,exports){ },{"./init":21}],11:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -1937,7 +1950,7 @@ jschardet.ISO2022KRSMModel = {
}(require('./init')); }(require('./init'));
},{"./init":20}],11:[function(require,module,exports){ },{"./init":21}],12:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -2041,7 +2054,7 @@ jschardet.EUCJPProber.prototype = new jschardet.MultiByteCharSetProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],12:[function(require,module,exports){ },{"./init":21}],13:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -2644,7 +2657,7 @@ jschardet.EUCKRCharToFreqOrder = [
}(require('./init')); }(require('./init'));
},{"./init":20}],13:[function(require,module,exports){ },{"./init":21}],14:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -2697,7 +2710,7 @@ jschardet.EUCKRProber.prototype = new jschardet.MultiByteCharSetProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],14:[function(require,module,exports){ },{"./init":21}],15:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -3132,7 +3145,7 @@ jschardet.EUCTWCharToFreqOrder = [
}(require('./init')); }(require('./init'));
},{"./init":20}],15:[function(require,module,exports){ },{"./init":21}],16:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -3185,7 +3198,7 @@ jschardet.EUCTWProber.prototype = new jschardet.MultiByteCharSetProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],16:[function(require,module,exports){ },{"./init":21}],17:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -3664,7 +3677,7 @@ jschardet.GB2312CharToFreqOrder = [
}(require('./init')); }(require('./init'));
},{"./init":20}],17:[function(require,module,exports){ },{"./init":21}],18:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -3717,7 +3730,7 @@ jschardet.GB2312Prober.prototype = new jschardet.MultiByteCharSetProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],18:[function(require,module,exports){ },{"./init":21}],19:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -4041,9 +4054,9 @@ if (!Array.prototype.indexOf)
}(require('./init')); }(require('./init'));
},{"./init":20}],19:[function(require,module,exports){ },{"./init":21}],20:[function(require,module,exports){
module.exports = require('./init') module.exports = require('./init')
},{"./init":20}],20:[function(require,module,exports){ },{"./init":21}],21:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -4126,7 +4139,7 @@ jschardet.log = function() {
console.log.apply(console, arguments); console.log.apply(console, arguments);
} }
},{"./big5freq":2,"./big5prober":3,"./chardistribution":4,"./charsetgroupprober":5,"./charsetprober":6,"./codingstatemachine":7,"./constants":8,"./escprober":9,"./escsm":10,"./eucjpprober":11,"./euckrfreq":12,"./euckrprober":13,"./euctwfreq":14,"./euctwprober":15,"./gb2312freq":16,"./gb2312prober":17,"./hebrewprober":18,"./jisfreq":21,"./jpcntx":22,"./langbulgarianmodel":23,"./langcyrillicmodel":24,"./langgreekmodel":25,"./langhebrewmodel":26,"./langhungarianmodel":27,"./langthaimodel":28,"./latin1prober":29,"./mbcharsetprober":30,"./mbcsgroupprober":31,"./mbcssm":32,"./sbcharsetprober":33,"./sbcsgroupprober":34,"./sjisprober":35,"./universaldetector":36,"./utf8prober":37}],21:[function(require,module,exports){ },{"./big5freq":3,"./big5prober":4,"./chardistribution":5,"./charsetgroupprober":6,"./charsetprober":7,"./codingstatemachine":8,"./constants":9,"./escprober":10,"./escsm":11,"./eucjpprober":12,"./euckrfreq":13,"./euckrprober":14,"./euctwfreq":15,"./euctwprober":16,"./gb2312freq":17,"./gb2312prober":18,"./hebrewprober":19,"./jisfreq":22,"./jpcntx":23,"./langbulgarianmodel":24,"./langcyrillicmodel":25,"./langgreekmodel":26,"./langhebrewmodel":27,"./langhungarianmodel":28,"./langthaimodel":29,"./latin1prober":30,"./mbcharsetprober":31,"./mbcsgroupprober":32,"./mbcssm":33,"./sbcharsetprober":34,"./sbcsgroupprober":35,"./sjisprober":36,"./universaldetector":37,"./utf8prober":38}],22:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -4701,7 +4714,7 @@ jschardet.JISCharToFreqOrder = [
}(require('./init')); }(require('./init'));
},{"./init":20}],22:[function(require,module,exports){ },{"./init":21}],23:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -4945,7 +4958,7 @@ jschardet.EUCJPContextAnalysis.prototype = new jschardet.JapaneseContextAnalysis
}(require('./init')); }(require('./init'));
},{"./init":20}],23:[function(require,module,exports){ },{"./init":21}],24:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -5179,7 +5192,7 @@ jschardet.Win1251BulgarianModel = {
}(require('./init')); }(require('./init'));
},{"./init":20}],24:[function(require,module,exports){ },{"./init":21}],25:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -5514,7 +5527,7 @@ jschardet.Ibm855Model = {
}(require('./init')); }(require('./init'));
},{"./init":20}],25:[function(require,module,exports){ },{"./init":21}],26:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -5745,7 +5758,7 @@ jschardet.Win1253GreekModel = {
}(require('./init')); }(require('./init'));
},{"./init":20}],26:[function(require,module,exports){ },{"./init":21}],27:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -5950,7 +5963,7 @@ jschardet.Win1255HebrewModel = {
}(require('./init')); }(require('./init'));
},{"./init":20}],27:[function(require,module,exports){ },{"./init":21}],28:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -6181,7 +6194,7 @@ jschardet.Win1250HungarianModel = {
}(require('./init')); }(require('./init'));
},{"./init":20}],28:[function(require,module,exports){ },{"./init":21}],29:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -6387,7 +6400,7 @@ jschardet.TIS620ThaiModel = {
}(require('./init')); }(require('./init'));
},{"./init":20}],29:[function(require,module,exports){ },{"./init":21}],30:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -6555,7 +6568,7 @@ jschardet.Latin1Prober.prototype = new jschardet.CharSetProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],30:[function(require,module,exports){ },{"./init":21}],31:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -6658,7 +6671,7 @@ jschardet.MultiByteCharSetProber.prototype = new jschardet.CharSetProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],31:[function(require,module,exports){ },{"./init":21}],32:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -6707,7 +6720,7 @@ jschardet.MBCSGroupProber.prototype = new jschardet.CharSetGroupProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],32:[function(require,module,exports){ },{"./init":21}],33:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -7053,8 +7066,8 @@ jschardet.SJIS_cls = [
2,2,2,2,2,2,2,2, // d8 - df 2,2,2,2,2,2,2,2, // d8 - df
3,3,3,3,3,3,3,3, // e0 - e7 3,3,3,3,3,3,3,3, // e0 - e7
3,3,3,3,3,4,4,4, // e8 - ef 3,3,3,3,3,4,4,4, // e8 - ef
4,4,4,4,4,4,4,4, // f0 - f7 3,3,3,3,3,3,3,3, // f0 - f7
4,4,4,4,4,0,0,0 // f8 - ff 3,3,3,3,3,0,0,0 // f8 - ff
]; ];
jschardet.SJIS_st = [ jschardet.SJIS_st = [
@ -7265,7 +7278,7 @@ jschardet.UTF8SMModel = {
}(require('./init')); }(require('./init'));
},{"./init":20}],33:[function(require,module,exports){ },{"./init":21}],34:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -7406,7 +7419,7 @@ jschardet.SingleByteCharSetProber.prototype = new jschardet.CharSetProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],34:[function(require,module,exports){ },{"./init":21}],35:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -7474,7 +7487,7 @@ jschardet.SBCSGroupProber.prototype = new jschardet.CharSetGroupProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],35:[function(require,module,exports){ },{"./init":21}],36:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -7577,7 +7590,7 @@ jschardet.SJISProber.prototype = new jschardet.MultiByteCharSetProber();
}(require('./init')); }(require('./init'));
},{"./init":20}],36:[function(require,module,exports){ },{"./init":21}],37:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -7789,7 +7802,7 @@ jschardet.UniversalDetector = function() {
}(require('./init')); }(require('./init'));
},{"./init":20}],37:[function(require,module,exports){ },{"./init":21}],38:[function(require,module,exports){
/* /*
* The Original Code is Mozilla Universal charset detector code. * The Original Code is Mozilla Universal charset detector code.
* *
@ -7886,5 +7899,5 @@ jschardet.UTF8Prober.prototype = new jschardet.CharSetProber();
}(require('./init')); }(require('./init'));
},{"./init":20}]},{},[1])(1) },{"./init":21}]},{},[1])(1)
}); });

1344
tools/eslint/node_modules/jschardet/dist/jschardet.min.js

File diff suppressed because it is too large

10
tools/eslint/node_modules/jschardet/package.json

@ -1,8 +1,8 @@
{ {
"_from": "jschardet@^1.4.2", "_from": "jschardet@^1.4.2",
"_id": "jschardet@1.4.2", "_id": "jschardet@1.5.0",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-KqEH8UKvQSHRRWWdRPUIMJYeaZo=", "_integrity": "sha512-+Q8JsoEQbrdE+a/gg1F9XO92gcKXgpE5UACqr0sIubjDmBEkd+OOWPGzQeMrWSLxd73r4dHxBeRW7edHu5LmJQ==",
"_location": "/eslint/jschardet", "_location": "/eslint/jschardet",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -18,8 +18,8 @@
"_requiredBy": [ "_requiredBy": [
"/eslint/external-editor" "/eslint/external-editor"
], ],
"_resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.4.2.tgz", "_resolved": "https://registry.npmjs.org/jschardet/-/jschardet-1.5.0.tgz",
"_shasum": "2aa107f142af4121d145659d44f50830961e699a", "_shasum": "a61f310306a5a71188e1b1acd08add3cfbb08b1e",
"_spec": "jschardet@^1.4.2", "_spec": "jschardet@^1.4.2",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/external-editor", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/external-editor",
"author": { "author": {
@ -59,5 +59,5 @@
"dist": "npm run dist-dev && java -jar node_modules/google-closure-compiler/compiler.jar --warning_level QUIET --compilation_level SIMPLE_OPTIMIZATIONS --js dist/jschardet.js > dist/jschardet.min.js", "dist": "npm run dist-dev && java -jar node_modules/google-closure-compiler/compiler.jar --warning_level QUIET --compilation_level SIMPLE_OPTIMIZATIONS --js dist/jschardet.js > dist/jschardet.min.js",
"dist-dev": "mkdir -p dist && browserify index.js -s jschardet --detect-globals false -o dist/jschardet.js" "dist-dev": "mkdir -p dist && browserify index.js -s jschardet --detect-globals false -o dist/jschardet.js"
}, },
"version": "1.4.2" "version": "1.5.0"
} }

10
tools/eslint/node_modules/jschardet/src/chardistribution.js

@ -33,6 +33,8 @@ jschardet.CharDistributionAnalysis = function() {
var ENOUGH_DATA_THRESHOLD = 1024; var ENOUGH_DATA_THRESHOLD = 1024;
var SURE_YES = 0.99; var SURE_YES = 0.99;
var SURE_NO = 0.01; var SURE_NO = 0.01;
var MINIMUM_DATA_THRESHOLD = 3;
var self = this; var self = this;
function init() { function init() {
@ -77,7 +79,7 @@ jschardet.CharDistributionAnalysis = function() {
*/ */
this.getConfidence = function() { this.getConfidence = function() {
// if we didn't receive any character in our consideration range, return negative answer // if we didn't receive any character in our consideration range, return negative answer
if( this._mTotalChars <= 0 ) { if( this._mTotalChars <= 0 || this._mFreqChars <= MINIMUM_DATA_THRESHOLD) {
return SURE_NO; return SURE_NO;
} }
if( this._mTotalChars != this._mFreqChars ) { if( this._mTotalChars != this._mFreqChars ) {
@ -232,8 +234,8 @@ jschardet.SJISDistributionAnalysis = function() {
this.getOrder = function(aStr) { this.getOrder = function(aStr) {
// for sjis encoding, we are interested // for sjis encoding, we are interested
// first byte range: 0x81 -- 0x9f , 0xe0 -- 0xfe // first byte range: 0x81 -- 0x9f , 0xe0 -- 0xef
// second byte range: 0x40 -- 0x7e, 0x81 -- 0xfe // second byte range: 0x40 -- 0x7e, 0x80 -- 0xfc
// no validation needed here. State machine has done that // no validation needed here. State machine has done that
if( aStr.charCodeAt(0) >= 0x81 && aStr.charCodeAt(0) <= 0x9F ) { if( aStr.charCodeAt(0) >= 0x81 && aStr.charCodeAt(0) <= 0x9F ) {
var order = 188 * (aStr.charCodeAt(0) - 0x81); var order = 188 * (aStr.charCodeAt(0) - 0x81);
@ -243,7 +245,7 @@ jschardet.SJISDistributionAnalysis = function() {
return -1; return -1;
} }
order += aStr.charCodeAt(1) - 0x40; order += aStr.charCodeAt(1) - 0x40;
if( aStr.charCodeAt(1) > 0x7F ) { if( aStr.charCodeAt(1) < 0x40 || aStr.charCodeAt(1) === 0x7F || aStr.charCodeAt(1) > 0xFC) {
order = -1; order = -1;
} }
return order; return order;

4
tools/eslint/node_modules/jschardet/src/mbcssm.js

@ -343,8 +343,8 @@ jschardet.SJIS_cls = [
2,2,2,2,2,2,2,2, // d8 - df 2,2,2,2,2,2,2,2, // d8 - df
3,3,3,3,3,3,3,3, // e0 - e7 3,3,3,3,3,3,3,3, // e0 - e7
3,3,3,3,3,4,4,4, // e8 - ef 3,3,3,3,3,4,4,4, // e8 - ef
4,4,4,4,4,4,4,4, // f0 - f7 3,3,3,3,3,3,3,3, // f0 - f7
4,4,4,4,4,0,0,0 // f8 - ff 3,3,3,3,3,0,0,0 // f8 - ff
]; ];
jschardet.SJIS_st = [ jschardet.SJIS_st = [

15
tools/eslint/node_modules/lru-cache/LICENSE

@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

152
tools/eslint/node_modules/lru-cache/README.md

@ -0,0 +1,152 @@
# lru cache
A cache object that deletes the least-recently-used items.
[![Build Status](https://travis-ci.org/isaacs/node-lru-cache.svg?branch=master)](https://travis-ci.org/isaacs/node-lru-cache) [![Coverage Status](https://coveralls.io/repos/isaacs/node-lru-cache/badge.svg?service=github)](https://coveralls.io/github/isaacs/node-lru-cache)
## Installation:
```javascript
npm install lru-cache --save
```
## Usage:
```javascript
var LRU = require("lru-cache")
, options = { max: 500
, length: function (n, key) { return n * 2 + key.length }
, dispose: function (key, n) { n.close() }
, maxAge: 1000 * 60 * 60 }
, cache = LRU(options)
, otherCache = LRU(50) // sets just the max size
cache.set("key", "value")
cache.get("key") // "value"
// non-string keys ARE fully supported
var someObject = {}
cache.set(someObject, 'a value')
cache.set('[object Object]', 'a different value')
assert.equal(cache.get(someObject), 'a value')
cache.reset() // empty the cache
```
If you put more stuff in it, then items will fall out.
If you try to put an oversized thing in it, then it'll fall out right
away.
## Options
* `max` The maximum size of the cache, checked by applying the length
function to all values in the cache. Not setting this is kind of
silly, since that's the whole purpose of this lib, but it defaults
to `Infinity`.
* `maxAge` Maximum age in ms. Items are not pro-actively pruned out
as they age, but if you try to get an item that is too old, it'll
drop it and return undefined instead of giving it to you.
* `length` Function that is used to calculate the length of stored
items. If you're storing strings or buffers, then you probably want
to do something like `function(n, key){return n.length}`. The default is
`function(){return 1}`, which is fine if you want to store `max`
like-sized things. The item is passed as the first argument, and
the key is passed as the second argumnet.
* `dispose` Function that is called on items when they are dropped
from the cache. This can be handy if you want to close file
descriptors or do other cleanup tasks when items are no longer
accessible. Called with `key, value`. It's called *before*
actually removing the item from the internal cache, so if you want
to immediately put it back in, you'll have to do that in a
`nextTick` or `setTimeout` callback or it won't do anything.
* `stale` By default, if you set a `maxAge`, it'll only actually pull
stale items out of the cache when you `get(key)`. (That is, it's
not pre-emptively doing a `setTimeout` or anything.) If you set
`stale:true`, it'll return the stale value before deleting it. If
you don't set this, then it'll return `undefined` when you try to
get a stale entry, as if it had already been deleted.
* `noDisposeOnSet` By default, if you set a `dispose()` method, then
it'll be called whenever a `set()` operation overwrites an existing
key. If you set this option, `dispose()` will only be called when a
key falls out of the cache, not when it is overwritten.
## API
* `set(key, value, maxAge)`
* `get(key) => value`
Both of these will update the "recently used"-ness of the key.
They do what you think. `maxAge` is optional and overrides the
cache `maxAge` option if provided.
If the key is not found, `get()` will return `undefined`.
The key and val can be any value.
* `peek(key)`
Returns the key value (or `undefined` if not found) without
updating the "recently used"-ness of the key.
(If you find yourself using this a lot, you *might* be using the
wrong sort of data structure, but there are some use cases where
it's handy.)
* `del(key)`
Deletes a key out of the cache.
* `reset()`
Clear the cache entirely, throwing away all values.
* `has(key)`
Check if a key is in the cache, without updating the recent-ness
or deleting it for being stale.
* `forEach(function(value,key,cache), [thisp])`
Just like `Array.prototype.forEach`. Iterates over all the keys
in the cache, in order of recent-ness. (Ie, more recently used
items are iterated over first.)
* `rforEach(function(value,key,cache), [thisp])`
The same as `cache.forEach(...)` but items are iterated over in
reverse order. (ie, less recently used items are iterated over
first.)
* `keys()`
Return an array of the keys in the cache.
* `values()`
Return an array of the values in the cache.
* `length`
Return total length of objects in cache taking into account
`length` options function.
* `itemCount`
Return total quantity of objects currently in cache. Note, that
`stale` (see options) items are returned as part of this item
count.
* `dump()`
Return an array of the cache entries ready for serialization and usage
with 'destinationCache.load(arr)`.
* `load(cacheEntriesArray)`
Loads another cache entries array, obtained with `sourceCache.dump()`,
into the cache. The destination cache is reset before loading new entries
* `prune()`
Manually iterates over the entire cache proactively pruning old entries

467
tools/eslint/node_modules/lru-cache/index.js

@ -0,0 +1,467 @@
'use strict'
module.exports = LRUCache
// This will be a proper iterable 'Map' in engines that support it,
// or a fakey-fake PseudoMap in older versions.
var Map = require('pseudomap')
var util = require('util')
// A linked list to keep track of recently-used-ness
var Yallist = require('yallist')
// use symbols if possible, otherwise just _props
var hasSymbol = typeof Symbol === 'function'
var makeSymbol
if (hasSymbol) {
makeSymbol = function (key) {
return Symbol.for(key)
}
} else {
makeSymbol = function (key) {
return '_' + key
}
}
var MAX = makeSymbol('max')
var LENGTH = makeSymbol('length')
var LENGTH_CALCULATOR = makeSymbol('lengthCalculator')
var ALLOW_STALE = makeSymbol('allowStale')
var MAX_AGE = makeSymbol('maxAge')
var DISPOSE = makeSymbol('dispose')
var NO_DISPOSE_ON_SET = makeSymbol('noDisposeOnSet')
var LRU_LIST = makeSymbol('lruList')
var CACHE = makeSymbol('cache')
function naiveLength () { return 1 }
// lruList is a yallist where the head is the youngest
// item, and the tail is the oldest. the list contains the Hit
// objects as the entries.
// Each Hit object has a reference to its Yallist.Node. This
// never changes.
//
// cache is a Map (or PseudoMap) that matches the keys to
// the Yallist.Node object.
function LRUCache (options) {
if (!(this instanceof LRUCache)) {
return new LRUCache(options)
}
if (typeof options === 'number') {
options = { max: options }
}
if (!options) {
options = {}
}
var max = this[MAX] = options.max
// Kind of weird to have a default max of Infinity, but oh well.
if (!max ||
!(typeof max === 'number') ||
max <= 0) {
this[MAX] = Infinity
}
var lc = options.length || naiveLength
if (typeof lc !== 'function') {
lc = naiveLength
}
this[LENGTH_CALCULATOR] = lc
this[ALLOW_STALE] = options.stale || false
this[MAX_AGE] = options.maxAge || 0
this[DISPOSE] = options.dispose
this[NO_DISPOSE_ON_SET] = options.noDisposeOnSet || false
this.reset()
}
// resize the cache when the max changes.
Object.defineProperty(LRUCache.prototype, 'max', {
set: function (mL) {
if (!mL || !(typeof mL === 'number') || mL <= 0) {
mL = Infinity
}
this[MAX] = mL
trim(this)
},
get: function () {
return this[MAX]
},
enumerable: true
})
Object.defineProperty(LRUCache.prototype, 'allowStale', {
set: function (allowStale) {
this[ALLOW_STALE] = !!allowStale
},
get: function () {
return this[ALLOW_STALE]
},
enumerable: true
})
Object.defineProperty(LRUCache.prototype, 'maxAge', {
set: function (mA) {
if (!mA || !(typeof mA === 'number') || mA < 0) {
mA = 0
}
this[MAX_AGE] = mA
trim(this)
},
get: function () {
return this[MAX_AGE]
},
enumerable: true
})
// resize the cache when the lengthCalculator changes.
Object.defineProperty(LRUCache.prototype, 'lengthCalculator', {
set: function (lC) {
if (typeof lC !== 'function') {
lC = naiveLength
}
if (lC !== this[LENGTH_CALCULATOR]) {
this[LENGTH_CALCULATOR] = lC
this[LENGTH] = 0
this[LRU_LIST].forEach(function (hit) {
hit.length = this[LENGTH_CALCULATOR](hit.value, hit.key)
this[LENGTH] += hit.length
}, this)
}
trim(this)
},
get: function () { return this[LENGTH_CALCULATOR] },
enumerable: true
})
Object.defineProperty(LRUCache.prototype, 'length', {
get: function () { return this[LENGTH] },
enumerable: true
})
Object.defineProperty(LRUCache.prototype, 'itemCount', {
get: function () { return this[LRU_LIST].length },
enumerable: true
})
LRUCache.prototype.rforEach = function (fn, thisp) {
thisp = thisp || this
for (var walker = this[LRU_LIST].tail; walker !== null;) {
var prev = walker.prev
forEachStep(this, fn, walker, thisp)
walker = prev
}
}
function forEachStep (self, fn, node, thisp) {
var hit = node.value
if (isStale(self, hit)) {
del(self, node)
if (!self[ALLOW_STALE]) {
hit = undefined
}
}
if (hit) {
fn.call(thisp, hit.value, hit.key, self)
}
}
LRUCache.prototype.forEach = function (fn, thisp) {
thisp = thisp || this
for (var walker = this[LRU_LIST].head; walker !== null;) {
var next = walker.next
forEachStep(this, fn, walker, thisp)
walker = next
}
}
LRUCache.prototype.keys = function () {
return this[LRU_LIST].toArray().map(function (k) {
return k.key
}, this)
}
LRUCache.prototype.values = function () {
return this[LRU_LIST].toArray().map(function (k) {
return k.value
}, this)
}
LRUCache.prototype.reset = function () {
if (this[DISPOSE] &&
this[LRU_LIST] &&
this[LRU_LIST].length) {
this[LRU_LIST].forEach(function (hit) {
this[DISPOSE](hit.key, hit.value)
}, this)
}
this[CACHE] = new Map() // hash of items by key
this[LRU_LIST] = new Yallist() // list of items in order of use recency
this[LENGTH] = 0 // length of items in the list
}
LRUCache.prototype.dump = function () {
return this[LRU_LIST].map(function (hit) {
if (!isStale(this, hit)) {
return {
k: hit.key,
v: hit.value,
e: hit.now + (hit.maxAge || 0)
}
}
}, this).toArray().filter(function (h) {
return h
})
}
LRUCache.prototype.dumpLru = function () {
return this[LRU_LIST]
}
LRUCache.prototype.inspect = function (n, opts) {
var str = 'LRUCache {'
var extras = false
var as = this[ALLOW_STALE]
if (as) {
str += '\n allowStale: true'
extras = true
}
var max = this[MAX]
if (max && max !== Infinity) {
if (extras) {
str += ','
}
str += '\n max: ' + util.inspect(max, opts)
extras = true
}
var maxAge = this[MAX_AGE]
if (maxAge) {
if (extras) {
str += ','
}
str += '\n maxAge: ' + util.inspect(maxAge, opts)
extras = true
}
var lc = this[LENGTH_CALCULATOR]
if (lc && lc !== naiveLength) {
if (extras) {
str += ','
}
str += '\n length: ' + util.inspect(this[LENGTH], opts)
extras = true
}
var didFirst = false
this[LRU_LIST].forEach(function (item) {
if (didFirst) {
str += ',\n '
} else {
if (extras) {
str += ',\n'
}
didFirst = true
str += '\n '
}
var key = util.inspect(item.key).split('\n').join('\n ')
var val = { value: item.value }
if (item.maxAge !== maxAge) {
val.maxAge = item.maxAge
}
if (lc !== naiveLength) {
val.length = item.length
}
if (isStale(this, item)) {
val.stale = true
}
val = util.inspect(val, opts).split('\n').join('\n ')
str += key + ' => ' + val
})
if (didFirst || extras) {
str += '\n'
}
str += '}'
return str
}
LRUCache.prototype.set = function (key, value, maxAge) {
maxAge = maxAge || this[MAX_AGE]
var now = maxAge ? Date.now() : 0
var len = this[LENGTH_CALCULATOR](value, key)
if (this[CACHE].has(key)) {
if (len > this[MAX]) {
del(this, this[CACHE].get(key))
return false
}
var node = this[CACHE].get(key)
var item = node.value
// dispose of the old one before overwriting
// split out into 2 ifs for better coverage tracking
if (this[DISPOSE]) {
if (!this[NO_DISPOSE_ON_SET]) {
this[DISPOSE](key, item.value)
}
}
item.now = now
item.maxAge = maxAge
item.value = value
this[LENGTH] += len - item.length
item.length = len
this.get(key)
trim(this)
return true
}
var hit = new Entry(key, value, len, now, maxAge)
// oversized objects fall out of cache automatically.
if (hit.length > this[MAX]) {
if (this[DISPOSE]) {
this[DISPOSE](key, value)
}
return false
}
this[LENGTH] += hit.length
this[LRU_LIST].unshift(hit)
this[CACHE].set(key, this[LRU_LIST].head)
trim(this)
return true
}
LRUCache.prototype.has = function (key) {
if (!this[CACHE].has(key)) return false
var hit = this[CACHE].get(key).value
if (isStale(this, hit)) {
return false
}
return true
}
LRUCache.prototype.get = function (key) {
return get(this, key, true)
}
LRUCache.prototype.peek = function (key) {
return get(this, key, false)
}
LRUCache.prototype.pop = function () {
var node = this[LRU_LIST].tail
if (!node) return null
del(this, node)
return node.value
}
LRUCache.prototype.del = function (key) {
del(this, this[CACHE].get(key))
}
LRUCache.prototype.load = function (arr) {
// reset the cache
this.reset()
var now = Date.now()
// A previous serialized cache has the most recent items first
for (var l = arr.length - 1; l >= 0; l--) {
var hit = arr[l]
var expiresAt = hit.e || 0
if (expiresAt === 0) {
// the item was created without expiration in a non aged cache
this.set(hit.k, hit.v)
} else {
var maxAge = expiresAt - now
// dont add already expired items
if (maxAge > 0) {
this.set(hit.k, hit.v, maxAge)
}
}
}
}
LRUCache.prototype.prune = function () {
var self = this
this[CACHE].forEach(function (value, key) {
get(self, key, false)
})
}
function get (self, key, doUse) {
var node = self[CACHE].get(key)
if (node) {
var hit = node.value
if (isStale(self, hit)) {
del(self, node)
if (!self[ALLOW_STALE]) hit = undefined
} else {
if (doUse) {
self[LRU_LIST].unshiftNode(node)
}
}
if (hit) hit = hit.value
}
return hit
}
function isStale (self, hit) {
if (!hit || (!hit.maxAge && !self[MAX_AGE])) {
return false
}
var stale = false
var diff = Date.now() - hit.now
if (hit.maxAge) {
stale = diff > hit.maxAge
} else {
stale = self[MAX_AGE] && (diff > self[MAX_AGE])
}
return stale
}
function trim (self) {
if (self[LENGTH] > self[MAX]) {
for (var walker = self[LRU_LIST].tail;
self[LENGTH] > self[MAX] && walker !== null;) {
// We know that we're about to delete this one, and also
// what the next least recently used key will be, so just
// go ahead and set it now.
var prev = walker.prev
del(self, walker)
walker = prev
}
}
}
function del (self, node) {
if (node) {
var hit = node.value
if (self[DISPOSE]) {
self[DISPOSE](hit.key, hit.value)
}
self[LENGTH] -= hit.length
self[CACHE].delete(hit.key)
self[LRU_LIST].removeNode(node)
}
}
// classy, since V8 prefers predictable objects.
function Entry (key, value, length, now, maxAge) {
this.key = key
this.value = value
this.length = length
this.now = now
this.maxAge = maxAge || 0
}

68
tools/eslint/node_modules/lru-cache/package.json

@ -0,0 +1,68 @@
{
"_from": "lru-cache@^4.0.1",
"_id": "lru-cache@4.1.1",
"_inBundle": false,
"_integrity": "sha512-q4spe4KTfsAS1SUHLO0wz8Qiyf1+vMIAgpRYioFYDMNqKfHQbg+AVDH3i4fvpl71/P1L0dBl+fQi+P37UYf0ew==",
"_location": "/eslint/lru-cache",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "lru-cache@^4.0.1",
"name": "lru-cache",
"escapedName": "lru-cache",
"rawSpec": "^4.0.1",
"saveSpec": null,
"fetchSpec": "^4.0.1"
},
"_requiredBy": [
"/eslint/cross-spawn"
],
"_resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-4.1.1.tgz",
"_shasum": "622e32e82488b49279114a4f9ecf45e7cd6bba55",
"_spec": "lru-cache@^4.0.1",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/cross-spawn",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me"
},
"bugs": {
"url": "https://github.com/isaacs/node-lru-cache/issues"
},
"bundleDependencies": false,
"dependencies": {
"pseudomap": "^1.0.2",
"yallist": "^2.1.2"
},
"deprecated": false,
"description": "A cache object that deletes the least-recently-used items.",
"devDependencies": {
"benchmark": "^2.1.4",
"standard": "^5.4.1",
"tap": "^10.3.3"
},
"files": [
"index.js"
],
"homepage": "https://github.com/isaacs/node-lru-cache#readme",
"keywords": [
"mru",
"lru",
"cache"
],
"license": "ISC",
"main": "index.js",
"name": "lru-cache",
"repository": {
"type": "git",
"url": "git://github.com/isaacs/node-lru-cache.git"
},
"scripts": {
"postpublish": "git push origin --all; git push origin --tags",
"posttest": "standard test/*.js index.js",
"postversion": "npm publish",
"preversion": "npm test",
"test": "tap test/*.js --100 -J"
},
"version": "4.1.1"
}

6
tools/eslint/node_modules/markdown-escapes/history.md

@ -1,6 +0,0 @@
<!--remark setext-->
<!--lint disable no-multiple-toplevel-headings -->
1.0.0 / 2016-07-16
==================

20
tools/eslint/node_modules/markdown-escapes/index.js

@ -1,19 +1,7 @@
/**
* @author Titus Wormer
* @copyright 2016 Titus Wormer
* @license MIT
* @module markdown-escapes
* @fileoverview List of escapable characters in markdown.
*/
'use strict'; 'use strict';
/* eslint-env commonjs */
/* Expose. */
module.exports = escapes; module.exports = escapes;
/* Characters. */
var defaults = [ var defaults = [
'\\', '\\',
'`', '`',
@ -53,17 +41,11 @@ var commonmark = gfm.concat([
'^' '^'
]); ]);
/* Expose characters. */
escapes.default = defaults; escapes.default = defaults;
escapes.gfm = gfm; escapes.gfm = gfm;
escapes.commonmark = commonmark; escapes.commonmark = commonmark;
/** /* Get markdown escapes. */
* Get markdown escapes.
*
* @param {Object?} [options] - Configuration.
* @return {Array.<string>} - Escapes.
*/
function escapes(options) { function escapes(options) {
var settings = options || {}; var settings = options || {};

40
tools/eslint/node_modules/markdown-escapes/package.json

@ -1,8 +1,8 @@
{ {
"_from": "markdown-escapes@^1.0.0", "_from": "markdown-escapes@^1.0.0",
"_id": "markdown-escapes@1.0.0", "_id": "markdown-escapes@1.0.1",
"_inBundle": false, "_inBundle": false,
"_integrity": "sha1-yMoZ8dlNaCRZ4Kk8htsnp+9xayM=", "_integrity": "sha1-GZTfLTr0gR3lmmcUk0wrIpJzRRg=",
"_location": "/markdown-escapes", "_location": "/markdown-escapes",
"_phantomChildren": {}, "_phantomChildren": {},
"_requested": { "_requested": {
@ -18,8 +18,8 @@
"_requiredBy": [ "_requiredBy": [
"/remark-parse" "/remark-parse"
], ],
"_resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.0.tgz", "_resolved": "https://registry.npmjs.org/markdown-escapes/-/markdown-escapes-1.0.1.tgz",
"_shasum": "c8ca19f1d94d682459e0a93c86db27a7ef716b23", "_shasum": "1994df2d3af4811de59a6714934c2b2292734518",
"_spec": "markdown-escapes@^1.0.0", "_spec": "markdown-escapes@^1.0.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/remark-parse", "_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/remark-parse",
"author": { "author": {
@ -42,16 +42,13 @@
"deprecated": false, "deprecated": false,
"description": "List of escapable characters in markdown", "description": "List of escapable characters in markdown",
"devDependencies": { "devDependencies": {
"browserify": "^13.0.1", "browserify": "^14.1.0",
"esmangle": "^1.0.1", "esmangle": "^1.0.1",
"nyc": "^7.0.0", "nyc": "^11.0.0",
"remark-cli": "^1.0.0", "remark-cli": "^3.0.0",
"remark-comment-config": "^4.0.0", "remark-preset-wooorm": "^3.0.0",
"remark-github": "^5.0.0",
"remark-lint": "^4.0.0",
"remark-validate-links": "^4.0.0",
"tape": "^4.0.0", "tape": "^4.0.0",
"xo": "^0.16.0" "xo": "^0.18.0"
}, },
"files": [ "files": [
"index.js" "index.js"
@ -73,16 +70,9 @@
"branches": 100 "branches": 100
}, },
"remarkConfig": { "remarkConfig": {
"output": true,
"plugins": [ "plugins": [
"comment-config", "preset-wooorm"
"github", ]
"lint",
"validate-links"
],
"settings": {
"bullet": "*"
}
}, },
"repository": { "repository": {
"type": "git", "type": "git",
@ -92,18 +82,18 @@
"build": "npm run build-md && npm run build-bundle && npm run build-mangle", "build": "npm run build-md && npm run build-bundle && npm run build-mangle",
"build-bundle": "browserify index.js --bare -s markdownEscapes > markdown-escapes.js", "build-bundle": "browserify index.js --bare -s markdownEscapes > markdown-escapes.js",
"build-mangle": "esmangle < markdown-escapes.js > markdown-escapes.min.js", "build-mangle": "esmangle < markdown-escapes.js > markdown-escapes.min.js",
"build-md": "remark . --quiet --frail", "build-md": "remark . -qfo",
"lint": "xo", "lint": "xo",
"test": "npm run build && npm run lint && npm run test-coverage", "test": "npm run build && npm run lint && npm run test-coverage",
"test-api": "node test", "test-api": "node test",
"test-coverage": "nyc --reporter lcov tape test.js" "test-coverage": "nyc --reporter lcov tape test.js"
}, },
"version": "1.0.0", "version": "1.0.1",
"xo": { "xo": {
"space": true, "space": true,
"esnext": false,
"ignores": [ "ignores": [
"markdown-escapes.js", "markdown-escapes.js"
"markdown-escapes.min.js"
] ]
} }
} }

12
tools/eslint/node_modules/markdown-escapes/readme.md

@ -1,12 +1,10 @@
# markdown-escapes [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov] # markdown-escapes [![Build Status][travis-badge]][travis] [![Coverage Status][codecov-badge]][codecov]
<!--lint disable heading-increment no-duplicate-headings-->
List of escapable characters in markdown. List of escapable characters in markdown.
## Installation ## Installation
[npm][npm-install]: [npm][]:
```bash ```bash
npm install markdown-escapes npm install markdown-escapes
@ -18,12 +16,10 @@ npm install markdown-escapes
var escapes = require('markdown-escapes'); var escapes = require('markdown-escapes');
// Access by property: // Access by property:
escapes.commonmark; escapes.commonmark; //=> ['\\', '`', ..., '@', '^']
// ['\\', '`', ..., '@', '^']
// Access by options object: // Access by options object:
escapes({gfm: true}); escapes({gfm: true}); //=> ['\\', '`', ..., '~', '|']
// ['\\', '`', ..., '~', '|']
``` ```
## API ## API
@ -64,7 +60,7 @@ List of escapable characters in CommonMark (which includes all `gfm`s).
[codecov]: https://codecov.io/github/wooorm/markdown-escapes [codecov]: https://codecov.io/github/wooorm/markdown-escapes
[npm-install]: https://docs.npmjs.com/cli/install [npm]: https://docs.npmjs.com/cli/install
[license]: LICENSE [license]: LICENSE

15
tools/eslint/node_modules/pseudomap/LICENSE

@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

60
tools/eslint/node_modules/pseudomap/README.md

@ -0,0 +1,60 @@
# pseudomap
A thing that is a lot like ES6 `Map`, but without iterators, for use
in environments where `for..of` syntax and `Map` are not available.
If you need iterators, or just in general a more faithful polyfill to
ES6 Maps, check out [es6-map](http://npm.im/es6-map).
If you are in an environment where `Map` is supported, then that will
be returned instead, unless `process.env.TEST_PSEUDOMAP` is set.
You can use any value as keys, and any value as data. Setting again
with the identical key will overwrite the previous value.
Internally, data is stored on an `Object.create(null)` style object.
The key is coerced to a string to generate the key on the internal
data-bag object. The original key used is stored along with the data.
In the event of a stringified-key collision, a new key is generated by
appending an increasing number to the stringified-key until finding
either the intended key or an empty spot.
Note that because object traversal order of plain objects is not
guaranteed to be identical to insertion order, the insertion order
guarantee of `Map.prototype.forEach` is not guaranteed in this
implementation. However, in all versions of Node.js and V8 where this
module works, `forEach` does traverse data in insertion order.
## API
Most of the [Map
API](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Map),
with the following exceptions:
1. A `Map` object is not an iterator.
2. `values`, `keys`, and `entries` methods are not implemented,
because they return iterators.
3. The argument to the constructor can be an Array of `[key, value]`
pairs, or a `Map` or `PseudoMap` object. But, since iterators
aren't used, passing any plain-old iterator won't initialize the
map properly.
## USAGE
Use just like a regular ES6 Map.
```javascript
var PseudoMap = require('pseudomap')
// optionally provide a pseudomap, or an array of [key,value] pairs
// as the argument to initialize the map with
var myMap = new PseudoMap()
myMap.set(1, 'number 1')
myMap.set('1', 'string 1')
var akey = {}
var bkey = {}
myMap.set(akey, { some: 'data' })
myMap.set(bkey, { some: 'other data' })
```

9
tools/eslint/node_modules/pseudomap/map.js

@ -0,0 +1,9 @@
if (process.env.npm_package_name === 'pseudomap' &&
process.env.npm_lifecycle_script === 'test')
process.env.TEST_PSEUDOMAP = 'true'
if (typeof Map === 'function' && !process.env.TEST_PSEUDOMAP) {
module.exports = Map
} else {
module.exports = require('./pseudomap')
}

54
tools/eslint/node_modules/pseudomap/package.json

@ -0,0 +1,54 @@
{
"_from": "pseudomap@^1.0.2",
"_id": "pseudomap@1.0.2",
"_inBundle": false,
"_integrity": "sha1-8FKijacOYYkX7wqKw0wa5aaChrM=",
"_location": "/eslint/pseudomap",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "pseudomap@^1.0.2",
"name": "pseudomap",
"escapedName": "pseudomap",
"rawSpec": "^1.0.2",
"saveSpec": null,
"fetchSpec": "^1.0.2"
},
"_requiredBy": [
"/eslint/lru-cache"
],
"_resolved": "https://registry.npmjs.org/pseudomap/-/pseudomap-1.0.2.tgz",
"_shasum": "f052a28da70e618917ef0a8ac34c1ae5a68286b3",
"_spec": "pseudomap@^1.0.2",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/lru-cache",
"author": {
"name": "Isaac Z. Schlueter",
"email": "i@izs.me",
"url": "http://blog.izs.me/"
},
"bugs": {
"url": "https://github.com/isaacs/pseudomap/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "A thing that is a lot like ES6 `Map`, but without iterators, for use in environments where `for..of` syntax and `Map` are not available.",
"devDependencies": {
"tap": "^2.3.1"
},
"directories": {
"test": "test"
},
"homepage": "https://github.com/isaacs/pseudomap#readme",
"license": "ISC",
"main": "map.js",
"name": "pseudomap",
"repository": {
"type": "git",
"url": "git+https://github.com/isaacs/pseudomap.git"
},
"scripts": {
"test": "tap test/*.js"
},
"version": "1.0.2"
}

113
tools/eslint/node_modules/pseudomap/pseudomap.js

@ -0,0 +1,113 @@
var hasOwnProperty = Object.prototype.hasOwnProperty
module.exports = PseudoMap
function PseudoMap (set) {
if (!(this instanceof PseudoMap)) // whyyyyyyy
throw new TypeError("Constructor PseudoMap requires 'new'")
this.clear()
if (set) {
if ((set instanceof PseudoMap) ||
(typeof Map === 'function' && set instanceof Map))
set.forEach(function (value, key) {
this.set(key, value)
}, this)
else if (Array.isArray(set))
set.forEach(function (kv) {
this.set(kv[0], kv[1])
}, this)
else
throw new TypeError('invalid argument')
}
}
PseudoMap.prototype.forEach = function (fn, thisp) {
thisp = thisp || this
Object.keys(this._data).forEach(function (k) {
if (k !== 'size')
fn.call(thisp, this._data[k].value, this._data[k].key)
}, this)
}
PseudoMap.prototype.has = function (k) {
return !!find(this._data, k)
}
PseudoMap.prototype.get = function (k) {
var res = find(this._data, k)
return res && res.value
}
PseudoMap.prototype.set = function (k, v) {
set(this._data, k, v)
}
PseudoMap.prototype.delete = function (k) {
var res = find(this._data, k)
if (res) {
delete this._data[res._index]
this._data.size--
}
}
PseudoMap.prototype.clear = function () {
var data = Object.create(null)
data.size = 0
Object.defineProperty(this, '_data', {
value: data,
enumerable: false,
configurable: true,
writable: false
})
}
Object.defineProperty(PseudoMap.prototype, 'size', {
get: function () {
return this._data.size
},
set: function (n) {},
enumerable: true,
configurable: true
})
PseudoMap.prototype.values =
PseudoMap.prototype.keys =
PseudoMap.prototype.entries = function () {
throw new Error('iterators are not implemented in this version')
}
// Either identical, or both NaN
function same (a, b) {
return a === b || a !== a && b !== b
}
function Entry (k, v, i) {
this.key = k
this.value = v
this._index = i
}
function find (data, k) {
for (var i = 0, s = '_' + k, key = s;
hasOwnProperty.call(data, key);
key = s + i++) {
if (same(data[key].key, k))
return data[key]
}
}
function set (data, k, v) {
for (var i = 0, s = '_' + k, key = s;
hasOwnProperty.call(data, key);
key = s + i++) {
if (same(data[key].key, k)) {
data[key].value = v
return
}
}
data.size++
data[key] = new Entry(k, v, key)
}

15
tools/eslint/node_modules/semver/LICENSE

@ -0,0 +1,15 @@
The ISC License
Copyright (c) Isaac Z. Schlueter and Contributors
Permission to use, copy, modify, and/or distribute this software for any
purpose with or without fee is hereby granted, provided that the above
copyright notice and this permission notice appear in all copies.
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.

350
tools/eslint/node_modules/semver/README.md

@ -0,0 +1,350 @@
semver(1) -- The semantic versioner for npm
===========================================
## Usage
$ npm install semver
$ node
var semver = require('semver')
semver.valid('1.2.3') // '1.2.3'
semver.valid('a.b.c') // null
semver.clean(' =v1.2.3 ') // '1.2.3'
semver.satisfies('1.2.3', '1.x || >=2.5.0 || 5.0.0 - 7.2.3') // true
semver.gt('1.2.3', '9.8.7') // false
semver.lt('1.2.3', '9.8.7') // true
As a command-line utility:
$ semver -h
SemVer 5.1.0
A JavaScript implementation of the http://semver.org/ specification
Copyright Isaac Z. Schlueter
Usage: semver [options] <version> [<version> [...]]
Prints valid versions sorted by SemVer precedence
Options:
-r --range <range>
Print versions that match the specified range.
-i --increment [<level>]
Increment a version by the specified level. Level can
be one of: major, minor, patch, premajor, preminor,
prepatch, or prerelease. Default level is 'patch'.
Only one version may be specified.
--preid <identifier>
Identifier to be used to prefix premajor, preminor,
prepatch or prerelease version increments.
-l --loose
Interpret versions and ranges loosely
Program exits successfully if any valid version satisfies
all supplied ranges, and prints all satisfying versions.
If no satisfying versions are found, then exits failure.
Versions are printed in ascending order, so supplying
multiple versions to the utility will just sort them.
## Versions
A "version" is described by the `v2.0.0` specification found at
<http://semver.org/>.
A leading `"="` or `"v"` character is stripped off and ignored.
## Ranges
A `version range` is a set of `comparators` which specify versions
that satisfy the range.
A `comparator` is composed of an `operator` and a `version`. The set
of primitive `operators` is:
* `<` Less than
* `<=` Less than or equal to
* `>` Greater than
* `>=` Greater than or equal to
* `=` Equal. If no operator is specified, then equality is assumed,
so this operator is optional, but MAY be included.
For example, the comparator `>=1.2.7` would match the versions
`1.2.7`, `1.2.8`, `2.5.3`, and `1.3.9`, but not the versions `1.2.6`
or `1.1.0`.
Comparators can be joined by whitespace to form a `comparator set`,
which is satisfied by the **intersection** of all of the comparators
it includes.
A range is composed of one or more comparator sets, joined by `||`. A
version matches a range if and only if every comparator in at least
one of the `||`-separated comparator sets is satisfied by the version.
For example, the range `>=1.2.7 <1.3.0` would match the versions
`1.2.7`, `1.2.8`, and `1.2.99`, but not the versions `1.2.6`, `1.3.0`,
or `1.1.0`.
The range `1.2.7 || >=1.2.9 <2.0.0` would match the versions `1.2.7`,
`1.2.9`, and `1.4.6`, but not the versions `1.2.8` or `2.0.0`.
### Prerelease Tags
If a version has a prerelease tag (for example, `1.2.3-alpha.3`) then
it will only be allowed to satisfy comparator sets if at least one
comparator with the same `[major, minor, patch]` tuple also has a
prerelease tag.
For example, the range `>1.2.3-alpha.3` would be allowed to match the
version `1.2.3-alpha.7`, but it would *not* be satisfied by
`3.4.5-alpha.9`, even though `3.4.5-alpha.9` is technically "greater
than" `1.2.3-alpha.3` according to the SemVer sort rules. The version
range only accepts prerelease tags on the `1.2.3` version. The
version `3.4.5` *would* satisfy the range, because it does not have a
prerelease flag, and `3.4.5` is greater than `1.2.3-alpha.7`.
The purpose for this behavior is twofold. First, prerelease versions
frequently are updated very quickly, and contain many breaking changes
that are (by the author's design) not yet fit for public consumption.
Therefore, by default, they are excluded from range matching
semantics.
Second, a user who has opted into using a prerelease version has
clearly indicated the intent to use *that specific* set of
alpha/beta/rc versions. By including a prerelease tag in the range,
the user is indicating that they are aware of the risk. However, it
is still not appropriate to assume that they have opted into taking a
similar risk on the *next* set of prerelease versions.
#### Prerelease Identifiers
The method `.inc` takes an additional `identifier` string argument that
will append the value of the string as a prerelease identifier:
```javascript
> semver.inc('1.2.3', 'prerelease', 'beta')
'1.2.4-beta.0'
```
command-line example:
```shell
$ semver 1.2.3 -i prerelease --preid beta
1.2.4-beta.0
```
Which then can be used to increment further:
```shell
$ semver 1.2.4-beta.0 -i prerelease
1.2.4-beta.1
```
### Advanced Range Syntax
Advanced range syntax desugars to primitive comparators in
deterministic ways.
Advanced ranges may be combined in the same way as primitive
comparators using white space or `||`.
#### Hyphen Ranges `X.Y.Z - A.B.C`
Specifies an inclusive set.
* `1.2.3 - 2.3.4` := `>=1.2.3 <=2.3.4`
If a partial version is provided as the first version in the inclusive
range, then the missing pieces are replaced with zeroes.
* `1.2 - 2.3.4` := `>=1.2.0 <=2.3.4`
If a partial version is provided as the second version in the
inclusive range, then all versions that start with the supplied parts
of the tuple are accepted, but nothing that would be greater than the
provided tuple parts.
* `1.2.3 - 2.3` := `>=1.2.3 <2.4.0`
* `1.2.3 - 2` := `>=1.2.3 <3.0.0`
#### X-Ranges `1.2.x` `1.X` `1.2.*` `*`
Any of `X`, `x`, or `*` may be used to "stand in" for one of the
numeric values in the `[major, minor, patch]` tuple.
* `*` := `>=0.0.0` (Any version satisfies)
* `1.x` := `>=1.0.0 <2.0.0` (Matching major version)
* `1.2.x` := `>=1.2.0 <1.3.0` (Matching major and minor versions)
A partial version range is treated as an X-Range, so the special
character is in fact optional.
* `""` (empty string) := `*` := `>=0.0.0`
* `1` := `1.x.x` := `>=1.0.0 <2.0.0`
* `1.2` := `1.2.x` := `>=1.2.0 <1.3.0`
#### Tilde Ranges `~1.2.3` `~1.2` `~1`
Allows patch-level changes if a minor version is specified on the
comparator. Allows minor-level changes if not.
* `~1.2.3` := `>=1.2.3 <1.(2+1).0` := `>=1.2.3 <1.3.0`
* `~1.2` := `>=1.2.0 <1.(2+1).0` := `>=1.2.0 <1.3.0` (Same as `1.2.x`)
* `~1` := `>=1.0.0 <(1+1).0.0` := `>=1.0.0 <2.0.0` (Same as `1.x`)
* `~0.2.3` := `>=0.2.3 <0.(2+1).0` := `>=0.2.3 <0.3.0`
* `~0.2` := `>=0.2.0 <0.(2+1).0` := `>=0.2.0 <0.3.0` (Same as `0.2.x`)
* `~0` := `>=0.0.0 <(0+1).0.0` := `>=0.0.0 <1.0.0` (Same as `0.x`)
* `~1.2.3-beta.2` := `>=1.2.3-beta.2 <1.3.0` Note that prereleases in
the `1.2.3` version will be allowed, if they are greater than or
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
`1.2.4-beta.2` would not, because it is a prerelease of a
different `[major, minor, patch]` tuple.
#### Caret Ranges `^1.2.3` `^0.2.5` `^0.0.4`
Allows changes that do not modify the left-most non-zero digit in the
`[major, minor, patch]` tuple. In other words, this allows patch and
minor updates for versions `1.0.0` and above, patch updates for
versions `0.X >=0.1.0`, and *no* updates for versions `0.0.X`.
Many authors treat a `0.x` version as if the `x` were the major
"breaking-change" indicator.
Caret ranges are ideal when an author may make breaking changes
between `0.2.4` and `0.3.0` releases, which is a common practice.
However, it presumes that there will *not* be breaking changes between
`0.2.4` and `0.2.5`. It allows for changes that are presumed to be
additive (but non-breaking), according to commonly observed practices.
* `^1.2.3` := `>=1.2.3 <2.0.0`
* `^0.2.3` := `>=0.2.3 <0.3.0`
* `^0.0.3` := `>=0.0.3 <0.0.4`
* `^1.2.3-beta.2` := `>=1.2.3-beta.2 <2.0.0` Note that prereleases in
the `1.2.3` version will be allowed, if they are greater than or
equal to `beta.2`. So, `1.2.3-beta.4` would be allowed, but
`1.2.4-beta.2` would not, because it is a prerelease of a
different `[major, minor, patch]` tuple.
* `^0.0.3-beta` := `>=0.0.3-beta <0.0.4` Note that prereleases in the
`0.0.3` version *only* will be allowed, if they are greater than or
equal to `beta`. So, `0.0.3-pr.2` would be allowed.
When parsing caret ranges, a missing `patch` value desugars to the
number `0`, but will allow flexibility within that value, even if the
major and minor versions are both `0`.
* `^1.2.x` := `>=1.2.0 <2.0.0`
* `^0.0.x` := `>=0.0.0 <0.1.0`
* `^0.0` := `>=0.0.0 <0.1.0`
A missing `minor` and `patch` values will desugar to zero, but also
allow flexibility within those values, even if the major version is
zero.
* `^1.x` := `>=1.0.0 <2.0.0`
* `^0.x` := `>=0.0.0 <1.0.0`
### Range Grammar
Putting all this together, here is a Backus-Naur grammar for ranges,
for the benefit of parser authors:
```bnf
range-set ::= range ( logical-or range ) *
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
range ::= hyphen | simple ( ' ' simple ) * | ''
hyphen ::= partial ' - ' partial
simple ::= primitive | partial | tilde | caret
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | ) partial
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
xr ::= 'x' | 'X' | '*' | nr
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
tilde ::= '~' partial
caret ::= '^' partial
qualifier ::= ( '-' pre )? ( '+' build )?
pre ::= parts
build ::= parts
parts ::= part ( '.' part ) *
part ::= nr | [-0-9A-Za-z]+
```
## Functions
All methods and classes take a final `loose` boolean argument that, if
true, will be more forgiving about not-quite-valid semver strings.
The resulting output will always be 100% strict, of course.
Strict-mode Comparators and Ranges will be strict about the SemVer
strings that they parse.
* `valid(v)`: Return the parsed version, or null if it's not valid.
* `inc(v, release)`: Return the version incremented by the release
type (`major`, `premajor`, `minor`, `preminor`, `patch`,
`prepatch`, or `prerelease`), or null if it's not valid
* `premajor` in one call will bump the version up to the next major
version and down to a prerelease of that major version.
`preminor`, and `prepatch` work the same way.
* If called from a non-prerelease version, the `prerelease` will work the
same as `prepatch`. It increments the patch version, then makes a
prerelease. If the input version is already a prerelease it simply
increments it.
* `prerelease(v)`: Returns an array of prerelease components, or null
if none exist. Example: `prerelease('1.2.3-alpha.1') -> ['alpha', 1]`
* `major(v)`: Return the major version number.
* `minor(v)`: Return the minor version number.
* `patch(v)`: Return the patch version number.
### Comparison
* `gt(v1, v2)`: `v1 > v2`
* `gte(v1, v2)`: `v1 >= v2`
* `lt(v1, v2)`: `v1 < v2`
* `lte(v1, v2)`: `v1 <= v2`
* `eq(v1, v2)`: `v1 == v2` This is true if they're logically equivalent,
even if they're not the exact same string. You already know how to
compare strings.
* `neq(v1, v2)`: `v1 != v2` The opposite of `eq`.
* `cmp(v1, comparator, v2)`: Pass in a comparison string, and it'll call
the corresponding function above. `"==="` and `"!=="` do simple
string comparison, but are included for completeness. Throws if an
invalid comparison string is provided.
* `compare(v1, v2)`: Return `0` if `v1 == v2`, or `1` if `v1` is greater, or `-1` if
`v2` is greater. Sorts in ascending order if passed to `Array.sort()`.
* `rcompare(v1, v2)`: The reverse of compare. Sorts an array of versions
in descending order when passed to `Array.sort()`.
* `diff(v1, v2)`: Returns difference between two versions by the release type
(`major`, `premajor`, `minor`, `preminor`, `patch`, `prepatch`, or `prerelease`),
or null if the versions are the same.
### Ranges
* `validRange(range)`: Return the valid range or null if it's not valid
* `satisfies(version, range)`: Return true if the version satisfies the
range.
* `maxSatisfying(versions, range)`: Return the highest version in the list
that satisfies the range, or `null` if none of them do.
* `minSatisfying(versions, range)`: Return the lowest version in the list
that satisfies the range, or `null` if none of them do.
* `gtr(version, range)`: Return `true` if version is greater than all the
versions possible in the range.
* `ltr(version, range)`: Return `true` if version is less than all the
versions possible in the range.
* `outside(version, range, hilo)`: Return true if the version is outside
the bounds of the range in either the high or low direction. The
`hilo` argument must be either the string `'>'` or `'<'`. (This is
the function called by `gtr` and `ltr`.)
Note that, since ranges may be non-contiguous, a version might not be
greater than a range, less than a range, *or* satisfy a range! For
example, the range `1.2 <1.2.9 || >2.0.0` would have a hole from `1.2.9`
until `2.0.0`, so the version `1.2.10` would not be greater than the
range (because `2.0.1` satisfies, which is higher), nor less than the
range (since `1.2.8` satisfies, which is lower), and it also does not
satisfy the range.
If you want to know if a version satisfies or does not satisfy a
range, use the `satisfies(version, range)` function.

133
tools/eslint/node_modules/semver/bin/semver

@ -0,0 +1,133 @@
#!/usr/bin/env node
// Standalone semver comparison program.
// Exits successfully and prints matching version(s) if
// any supplied version is valid and passes all tests.
var argv = process.argv.slice(2)
, versions = []
, range = []
, gt = []
, lt = []
, eq = []
, inc = null
, version = require("../package.json").version
, loose = false
, identifier = undefined
, semver = require("../semver")
, reverse = false
main()
function main () {
if (!argv.length) return help()
while (argv.length) {
var a = argv.shift()
var i = a.indexOf('=')
if (i !== -1) {
a = a.slice(0, i)
argv.unshift(a.slice(i + 1))
}
switch (a) {
case "-rv": case "-rev": case "--rev": case "--reverse":
reverse = true
break
case "-l": case "--loose":
loose = true
break
case "-v": case "--version":
versions.push(argv.shift())
break
case "-i": case "--inc": case "--increment":
switch (argv[0]) {
case "major": case "minor": case "patch": case "prerelease":
case "premajor": case "preminor": case "prepatch":
inc = argv.shift()
break
default:
inc = "patch"
break
}
break
case "--preid":
identifier = argv.shift()
break
case "-r": case "--range":
range.push(argv.shift())
break
case "-h": case "--help": case "-?":
return help()
default:
versions.push(a)
break
}
}
versions = versions.filter(function (v) {
return semver.valid(v, loose)
})
if (!versions.length) return fail()
if (inc && (versions.length !== 1 || range.length))
return failInc()
for (var i = 0, l = range.length; i < l ; i ++) {
versions = versions.filter(function (v) {
return semver.satisfies(v, range[i], loose)
})
if (!versions.length) return fail()
}
return success(versions)
}
function failInc () {
console.error("--inc can only be used on a single version with no range")
fail()
}
function fail () { process.exit(1) }
function success () {
var compare = reverse ? "rcompare" : "compare"
versions.sort(function (a, b) {
return semver[compare](a, b, loose)
}).map(function (v) {
return semver.clean(v, loose)
}).map(function (v) {
return inc ? semver.inc(v, inc, loose, identifier) : v
}).forEach(function (v,i,_) { console.log(v) })
}
function help () {
console.log(["SemVer " + version
,""
,"A JavaScript implementation of the http://semver.org/ specification"
,"Copyright Isaac Z. Schlueter"
,""
,"Usage: semver [options] <version> [<version> [...]]"
,"Prints valid versions sorted by SemVer precedence"
,""
,"Options:"
,"-r --range <range>"
," Print versions that match the specified range."
,""
,"-i --increment [<level>]"
," Increment a version by the specified level. Level can"
," be one of: major, minor, patch, premajor, preminor,"
," prepatch, or prerelease. Default level is 'patch'."
," Only one version may be specified."
,""
,"--preid <identifier>"
," Identifier to be used to prefix premajor, preminor,"
," prepatch or prerelease version increments."
,""
,"-l --loose"
," Interpret versions and ranges loosely"
,""
,"Program exits successfully if any valid version satisfies"
,"all supplied ranges, and prints all satisfying versions."
,""
,"If no satisfying versions are found, then exits failure."
,""
,"Versions are printed in ascending order, so supplying"
,"multiple versions to the utility will just sort them."
].join("\n"))
}

54
tools/eslint/node_modules/semver/package.json

@ -0,0 +1,54 @@
{
"_from": "semver@^5.3.0",
"_id": "semver@5.3.0",
"_inBundle": false,
"_integrity": "sha1-myzl094C0XxgEq0yaqa00M9U+U8=",
"_location": "/eslint/semver",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "semver@^5.3.0",
"name": "semver",
"escapedName": "semver",
"rawSpec": "^5.3.0",
"saveSpec": null,
"fetchSpec": "^5.3.0"
},
"_requiredBy": [
"/eslint"
],
"_resolved": "https://registry.npmjs.org/semver/-/semver-5.3.0.tgz",
"_shasum": "9b2ce5d3de02d17c6012ad326aa6b4d0cf54f94f",
"_spec": "semver@^5.3.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint",
"bin": {
"semver": "./bin/semver"
},
"bugs": {
"url": "https://github.com/npm/node-semver/issues"
},
"bundleDependencies": false,
"deprecated": false,
"description": "The semantic version parser used by npm.",
"devDependencies": {
"tap": "^2.0.0"
},
"files": [
"bin",
"range.bnf",
"semver.js"
],
"homepage": "https://github.com/npm/node-semver#readme",
"license": "ISC",
"main": "semver.js",
"name": "semver",
"repository": {
"type": "git",
"url": "git+https://github.com/npm/node-semver.git"
},
"scripts": {
"test": "tap test/*.js"
},
"version": "5.3.0"
}

16
tools/eslint/node_modules/semver/range.bnf

@ -0,0 +1,16 @@
range-set ::= range ( logical-or range ) *
logical-or ::= ( ' ' ) * '||' ( ' ' ) *
range ::= hyphen | simple ( ' ' simple ) * | ''
hyphen ::= partial ' - ' partial
simple ::= primitive | partial | tilde | caret
primitive ::= ( '<' | '>' | '>=' | '<=' | '=' | ) partial
partial ::= xr ( '.' xr ( '.' xr qualifier ? )? )?
xr ::= 'x' | 'X' | '*' | nr
nr ::= '0' | ['1'-'9'] ( ['0'-'9'] ) *
tilde ::= '~' partial
caret ::= '^' partial
qualifier ::= ( '-' pre )? ( '+' build )?
pre ::= parts
build ::= parts
parts ::= part ( '.' part ) *
part ::= nr | [-0-9A-Za-z]+

1203
tools/eslint/node_modules/semver/semver.js

File diff suppressed because it is too large

19
tools/eslint/node_modules/shebang-command/index.js

@ -0,0 +1,19 @@
'use strict';
var shebangRegex = require('shebang-regex');
module.exports = function (str) {
var match = str.match(shebangRegex);
if (!match) {
return null;
}
var arr = match[0].replace(/#! ?/, '').split(' ');
var bin = arr[0].split('/').pop();
var arg = arr[1];
return (bin === 'env' ?
arg :
bin + (arg ? ' ' + arg : '')
);
};

21
tools/eslint/node_modules/shebang-command/license

@ -0,0 +1,21 @@
The MIT License (MIT)
Copyright (c) Kevin Martensson <kevinmartensson@gmail.com> (github.com/kevva)
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
in the Software without restriction, including without limitation the rights
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
copies of the Software, and to permit persons to whom the Software is
furnished to do so, subject to the following conditions:
The above copyright notice and this permission notice shall be included in
all copies or substantial portions of the Software.
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
THE SOFTWARE.

71
tools/eslint/node_modules/shebang-command/package.json

@ -0,0 +1,71 @@
{
"_from": "shebang-command@^1.2.0",
"_id": "shebang-command@1.2.0",
"_inBundle": false,
"_integrity": "sha1-RKrGW2lbAzmJaMOfNj/uXer98eo=",
"_location": "/eslint/shebang-command",
"_phantomChildren": {},
"_requested": {
"type": "range",
"registry": true,
"raw": "shebang-command@^1.2.0",
"name": "shebang-command",
"escapedName": "shebang-command",
"rawSpec": "^1.2.0",
"saveSpec": null,
"fetchSpec": "^1.2.0"
},
"_requiredBy": [
"/eslint/cross-spawn"
],
"_resolved": "https://registry.npmjs.org/shebang-command/-/shebang-command-1.2.0.tgz",
"_shasum": "44aac65b695b03398968c39f363fee5deafdf1ea",
"_spec": "shebang-command@^1.2.0",
"_where": "/Users/trott/io.js/tools/eslint-tmp/node_modules/eslint/node_modules/cross-spawn",
"author": {
"name": "Kevin Martensson",
"email": "kevinmartensson@gmail.com",
"url": "github.com/kevva"
},
"bugs": {
"url": "https://github.com/kevva/shebang-command/issues"
},
"bundleDependencies": false,
"dependencies": {
"shebang-regex": "^1.0.0"
},
"deprecated": false,
"description": "Get the command from a shebang",
"devDependencies": {
"ava": "*",
"xo": "*"
},
"engines": {
"node": ">=0.10.0"
},
"files": [
"index.js"
],
"homepage": "https://github.com/kevva/shebang-command#readme",
"keywords": [
"cmd",
"command",
"parse",
"shebang"
],
"license": "MIT",
"name": "shebang-command",
"repository": {
"type": "git",
"url": "git+https://github.com/kevva/shebang-command.git"
},
"scripts": {
"test": "xo && ava"
},
"version": "1.2.0",
"xo": {
"ignores": [
"test.js"
]
}
}

39
tools/eslint/node_modules/shebang-command/readme.md

@ -0,0 +1,39 @@
# shebang-command [![Build Status](https://travis-ci.org/kevva/shebang-command.svg?branch=master)](https://travis-ci.org/kevva/shebang-command)
> Get the command from a shebang
## Install
```
$ npm install --save shebang-command
```
## Usage
```js
const shebangCommand = require('shebang-command');
shebangCommand('#!/usr/bin/env node');
//=> 'node'
shebangCommand('#!/bin/bash');
//=> 'bash'
```
## API
### shebangCommand(string)
#### string
Type: `string`
String containing a shebang.
## License
MIT © [Kevin Martensson](http://github.com/kevva)

Some files were not shown because too many files changed in this diff

Loading…
Cancel
Save