tools: update ESLint to 5.7.0
Update ESLint to 5.7.0. PR-URL: https://github.com/nodejs/node/pull/23629 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Sakthipriyan Vairamani <thechargingvolcano@gmail.com>
This commit is contained in:
parent
6783eedcb9
commit
ea9df8b4a4
44
tools/node_modules/eslint/lib/rules/camelcase.js
generated
vendored
44
tools/node_modules/eslint/lib/rules/camelcase.js
generated
vendored
@ -27,6 +27,16 @@ module.exports = {
|
||||
},
|
||||
properties: {
|
||||
enum: ["always", "never"]
|
||||
},
|
||||
allow: {
|
||||
type: "array",
|
||||
items: [
|
||||
{
|
||||
type: "string"
|
||||
}
|
||||
],
|
||||
minItems: 0,
|
||||
uniqueItems: true
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
@ -40,6 +50,15 @@ module.exports = {
|
||||
|
||||
create(context) {
|
||||
|
||||
const options = context.options[0] || {};
|
||||
let properties = options.properties || "";
|
||||
const ignoreDestructuring = options.ignoreDestructuring || false;
|
||||
const allow = options.allow || [];
|
||||
|
||||
if (properties !== "always" && properties !== "never") {
|
||||
properties = "always";
|
||||
}
|
||||
|
||||
//--------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//--------------------------------------------------------------------------
|
||||
@ -60,6 +79,18 @@ module.exports = {
|
||||
return name.indexOf("_") > -1 && name !== name.toUpperCase();
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a string match the ignore list
|
||||
* @param {string} name The string to check.
|
||||
* @returns {boolean} if the string is ignored
|
||||
* @private
|
||||
*/
|
||||
function isAllowed(name) {
|
||||
return allow.findIndex(
|
||||
entry => name === entry || name.match(new RegExp(entry))
|
||||
) !== -1;
|
||||
}
|
||||
|
||||
/**
|
||||
* Checks if a parent of a node is an ObjectPattern.
|
||||
* @param {ASTNode} node The node to check.
|
||||
@ -93,14 +124,6 @@ module.exports = {
|
||||
}
|
||||
}
|
||||
|
||||
const options = context.options[0] || {};
|
||||
let properties = options.properties || "";
|
||||
const ignoreDestructuring = options.ignoreDestructuring || false;
|
||||
|
||||
if (properties !== "always" && properties !== "never") {
|
||||
properties = "always";
|
||||
}
|
||||
|
||||
return {
|
||||
|
||||
Identifier(node) {
|
||||
@ -112,6 +135,11 @@ module.exports = {
|
||||
const name = node.name.replace(/^_+|_+$/g, ""),
|
||||
effectiveParent = (node.parent.type === "MemberExpression") ? node.parent.parent : node.parent;
|
||||
|
||||
// First, we ignore the node if it match the ignore list
|
||||
if (isAllowed(name)) {
|
||||
return;
|
||||
}
|
||||
|
||||
// MemberExpressions get special rules
|
||||
if (node.parent.type === "MemberExpression") {
|
||||
|
||||
|
22
tools/node_modules/eslint/lib/rules/no-extra-bind.js
generated
vendored
22
tools/node_modules/eslint/lib/rules/no-extra-bind.js
generated
vendored
@ -10,6 +10,12 @@
|
||||
|
||||
const astUtils = require("../util/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
const SIDE_EFFECT_FREE_NODE_TYPES = new Set(["Literal", "Identifier", "ThisExpression", "FunctionExpression"]);
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
@ -35,6 +41,18 @@ module.exports = {
|
||||
create(context) {
|
||||
let scopeInfo = null;
|
||||
|
||||
/**
|
||||
* Checks if a node is free of side effects.
|
||||
*
|
||||
* This check is stricter than it needs to be, in order to keep the implementation simple.
|
||||
*
|
||||
* @param {ASTNode} node A node to check.
|
||||
* @returns {boolean} True if the node is known to be side-effect free, false otherwise.
|
||||
*/
|
||||
function isSideEffectFree(node) {
|
||||
return SIDE_EFFECT_FREE_NODE_TYPES.has(node.type);
|
||||
}
|
||||
|
||||
/**
|
||||
* Reports a given function node.
|
||||
*
|
||||
@ -48,6 +66,10 @@ module.exports = {
|
||||
messageId: "unexpected",
|
||||
loc: node.parent.property.loc.start,
|
||||
fix(fixer) {
|
||||
if (node.parent.parent.arguments.length && !isSideEffectFree(node.parent.parent.arguments[0])) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const firstTokenToRemove = context.getSourceCode()
|
||||
.getFirstTokenBetween(node.parent.object, node.parent.property, astUtils.isNotClosingParenToken);
|
||||
|
||||
|
29
tools/node_modules/eslint/lib/rules/no-tabs.js
generated
vendored
29
tools/node_modules/eslint/lib/rules/no-tabs.js
generated
vendored
@ -8,7 +8,9 @@
|
||||
//------------------------------------------------------------------------------
|
||||
// Helpers
|
||||
//------------------------------------------------------------------------------
|
||||
const regex = /\t/;
|
||||
|
||||
const tabRegex = /\t+/g;
|
||||
const anyNonWhitespaceRegex = /\S/;
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Public Interface
|
||||
@ -22,21 +24,36 @@ module.exports = {
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/rules/no-tabs"
|
||||
},
|
||||
schema: []
|
||||
schema: [{
|
||||
type: "object",
|
||||
properties: {
|
||||
allowIndentationTabs: {
|
||||
type: "boolean"
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
}]
|
||||
},
|
||||
|
||||
create(context) {
|
||||
const sourceCode = context.getSourceCode();
|
||||
const allowIndentationTabs = context.options && context.options[0] && context.options[0].allowIndentationTabs;
|
||||
|
||||
return {
|
||||
Program(node) {
|
||||
context.getSourceCode().getLines().forEach((line, index) => {
|
||||
const match = regex.exec(line);
|
||||
sourceCode.getLines().forEach((line, index) => {
|
||||
let match;
|
||||
|
||||
while ((match = tabRegex.exec(line)) !== null) {
|
||||
if (allowIndentationTabs && !anyNonWhitespaceRegex.test(line.slice(0, match.index))) {
|
||||
continue;
|
||||
}
|
||||
|
||||
if (match) {
|
||||
context.report({
|
||||
node,
|
||||
loc: {
|
||||
line: index + 1,
|
||||
column: match.index + 1
|
||||
column: match.index
|
||||
},
|
||||
message: "Unexpected tab character."
|
||||
});
|
||||
|
2
tools/node_modules/eslint/lib/rules/no-unused-vars.js
generated
vendored
2
tools/node_modules/eslint/lib/rules/no-unused-vars.js
generated
vendored
@ -469,7 +469,7 @@ module.exports = {
|
||||
const posteriorParams = params.slice(params.indexOf(variable) + 1);
|
||||
|
||||
// If any used parameters occur after this parameter, do not report.
|
||||
return !posteriorParams.some(v => v.references.length > 0);
|
||||
return !posteriorParams.some(v => v.references.length > 0 || v.eslintUsed);
|
||||
}
|
||||
|
||||
/**
|
||||
|
5
tools/node_modules/eslint/lib/rules/one-var.js
generated
vendored
5
tools/node_modules/eslint/lib/rules/one-var.js
generated
vendored
@ -314,6 +314,11 @@ module.exports = {
|
||||
function splitDeclarations(declaration) {
|
||||
return fixer => declaration.declarations.map(declarator => {
|
||||
const tokenAfterDeclarator = sourceCode.getTokenAfter(declarator);
|
||||
|
||||
if (tokenAfterDeclarator === null) {
|
||||
return null;
|
||||
}
|
||||
|
||||
const afterComma = sourceCode.getTokenAfter(tokenAfterDeclarator, { includeComments: true });
|
||||
|
||||
if (tokenAfterDeclarator.value !== ",") {
|
||||
|
3
tools/node_modules/eslint/lib/rules/padding-line-between-statements.js
generated
vendored
3
tools/node_modules/eslint/lib/rules/padding-line-between-statements.js
generated
vendored
@ -353,6 +353,9 @@ const StatementTypes = {
|
||||
node.type === "ExpressionStatement" &&
|
||||
!isDirectivePrologue(node, sourceCode)
|
||||
},
|
||||
iife: {
|
||||
test: isIIFEStatement
|
||||
},
|
||||
"multiline-block-like": {
|
||||
test: (node, sourceCode) =>
|
||||
node.loc.start.line !== node.loc.end.line &&
|
||||
|
39
tools/node_modules/eslint/lib/rules/space-infix-ops.js
generated
vendored
39
tools/node_modules/eslint/lib/rules/space-infix-ops.js
generated
vendored
@ -34,37 +34,25 @@ module.exports = {
|
||||
|
||||
create(context) {
|
||||
const int32Hint = context.options[0] ? context.options[0].int32Hint === true : false;
|
||||
|
||||
const OPERATORS = [
|
||||
"*", "/", "%", "+", "-", "<<", ">>", ">>>", "<", "<=", ">", ">=", "in",
|
||||
"instanceof", "==", "!=", "===", "!==", "&", "^", "|", "&&", "||", "=",
|
||||
"+=", "-=", "*=", "/=", "%=", "<<=", ">>=", ">>>=", "&=", "^=", "|=",
|
||||
"?", ":", ",", "**"
|
||||
];
|
||||
|
||||
const sourceCode = context.getSourceCode();
|
||||
|
||||
/**
|
||||
* Returns the first token which violates the rule
|
||||
* @param {ASTNode} left - The left node of the main node
|
||||
* @param {ASTNode} right - The right node of the main node
|
||||
* @param {string} op - The operator of the main node
|
||||
* @returns {Object} The violator token or null
|
||||
* @private
|
||||
*/
|
||||
function getFirstNonSpacedToken(left, right) {
|
||||
const tokens = sourceCode.getTokensBetween(left, right, 1);
|
||||
function getFirstNonSpacedToken(left, right, op) {
|
||||
const operator = sourceCode.getFirstTokenBetween(left, right, token => token.value === op);
|
||||
const prev = sourceCode.getTokenBefore(operator);
|
||||
const next = sourceCode.getTokenAfter(operator);
|
||||
|
||||
for (let i = 1, l = tokens.length - 1; i < l; ++i) {
|
||||
const op = tokens[i];
|
||||
|
||||
if (
|
||||
(op.type === "Punctuator" || op.type === "Keyword") &&
|
||||
OPERATORS.indexOf(op.value) >= 0 &&
|
||||
(tokens[i - 1].range[1] >= op.range[0] || op.range[1] >= tokens[i + 1].range[0])
|
||||
) {
|
||||
return op;
|
||||
}
|
||||
if (!sourceCode.isSpaceBetweenTokens(prev, operator) || !sourceCode.isSpaceBetweenTokens(operator, next)) {
|
||||
return operator;
|
||||
}
|
||||
|
||||
return null;
|
||||
}
|
||||
|
||||
@ -110,7 +98,10 @@ module.exports = {
|
||||
const leftNode = (node.left.typeAnnotation) ? node.left.typeAnnotation : node.left;
|
||||
const rightNode = node.right;
|
||||
|
||||
const nonSpacedNode = getFirstNonSpacedToken(leftNode, rightNode);
|
||||
// search for = in AssignmentPattern nodes
|
||||
const operator = node.operator || "=";
|
||||
|
||||
const nonSpacedNode = getFirstNonSpacedToken(leftNode, rightNode, operator);
|
||||
|
||||
if (nonSpacedNode) {
|
||||
if (!(int32Hint && sourceCode.getText(node).endsWith("|0"))) {
|
||||
@ -126,8 +117,8 @@ module.exports = {
|
||||
* @private
|
||||
*/
|
||||
function checkConditional(node) {
|
||||
const nonSpacedConsequesntNode = getFirstNonSpacedToken(node.test, node.consequent);
|
||||
const nonSpacedAlternateNode = getFirstNonSpacedToken(node.consequent, node.alternate);
|
||||
const nonSpacedConsequesntNode = getFirstNonSpacedToken(node.test, node.consequent, "?");
|
||||
const nonSpacedAlternateNode = getFirstNonSpacedToken(node.consequent, node.alternate, ":");
|
||||
|
||||
if (nonSpacedConsequesntNode) {
|
||||
report(node, nonSpacedConsequesntNode);
|
||||
@ -147,7 +138,7 @@ module.exports = {
|
||||
const rightNode = node.init;
|
||||
|
||||
if (rightNode) {
|
||||
const nonSpacedNode = getFirstNonSpacedToken(leftNode, rightNode);
|
||||
const nonSpacedNode = getFirstNonSpacedToken(leftNode, rightNode, "=");
|
||||
|
||||
if (nonSpacedNode) {
|
||||
report(node, nonSpacedNode);
|
||||
|
21
tools/node_modules/eslint/node_modules/ajv-keywords/LICENSE
generated
vendored
21
tools/node_modules/eslint/node_modules/ajv-keywords/LICENSE
generated
vendored
@ -1,21 +0,0 @@
|
||||
The MIT License (MIT)
|
||||
|
||||
Copyright (c) 2016 Evgeny Poberezkin
|
||||
|
||||
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.
|
683
tools/node_modules/eslint/node_modules/ajv-keywords/README.md
generated
vendored
683
tools/node_modules/eslint/node_modules/ajv-keywords/README.md
generated
vendored
@ -1,683 +0,0 @@
|
||||
# ajv-keywords
|
||||
|
||||
Custom JSON-Schema keywords for [Ajv](https://github.com/epoberezkin/ajv) validator
|
||||
|
||||
[](https://travis-ci.org/epoberezkin/ajv-keywords)
|
||||
[](https://www.npmjs.com/package/ajv-keywords)
|
||||
[](https://www.npmjs.com/package/ajv-keywords)
|
||||
[](https://coveralls.io/github/epoberezkin/ajv-keywords?branch=master)
|
||||
[](https://greenkeeper.io/)
|
||||
[](https://gitter.im/ajv-validator/ajv)
|
||||
|
||||
|
||||
## Contents
|
||||
|
||||
- [Install](#install)
|
||||
- [Usage](#usage)
|
||||
- [Keywords](#keywords)
|
||||
- [typeof](#typeof)
|
||||
- [instanceof](#instanceof)
|
||||
- [range and exclusiveRange](#range-and-exclusiverange)
|
||||
- [switch](#switch)
|
||||
- [select/selectCases/selectDefault](#selectselectcasesselectdefault) (BETA)
|
||||
- [patternRequired](#patternrequired)
|
||||
- [prohibited](#prohibited)
|
||||
- [deepProperties](#deepproperties)
|
||||
- [deepRequired](#deeprequired)
|
||||
- [uniqueItemProperties](#uniqueitemproperties)
|
||||
- [regexp](#regexp)
|
||||
- [formatMaximum / formatMinimum and formatExclusiveMaximum / formatExclusiveMinimum](#formatmaximum--formatminimum-and-formatexclusivemaximum--formatexclusiveminimum)
|
||||
- [dynamicDefaults](#dynamicdefaults)
|
||||
- [transform](#transform)
|
||||
- [License](#license)
|
||||
|
||||
|
||||
## Install
|
||||
|
||||
```
|
||||
npm install ajv-keywords
|
||||
```
|
||||
|
||||
|
||||
## Usage
|
||||
|
||||
To add all available keywords:
|
||||
|
||||
```javascript
|
||||
var Ajv = require('ajv');
|
||||
var ajv = new Ajv;
|
||||
require('ajv-keywords')(ajv);
|
||||
|
||||
ajv.validate({ instanceof: 'RegExp' }, /.*/); // true
|
||||
ajv.validate({ instanceof: 'RegExp' }, '.*'); // false
|
||||
```
|
||||
|
||||
To add a single keyword:
|
||||
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, 'instanceof');
|
||||
```
|
||||
|
||||
To add multiple keywords:
|
||||
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, ['typeof', 'instanceof']);
|
||||
```
|
||||
|
||||
To add a single keyword in browser (to avoid adding unused code):
|
||||
|
||||
```javascript
|
||||
require('ajv-keywords/keywords/instanceof')(ajv);
|
||||
```
|
||||
|
||||
|
||||
## Keywords
|
||||
|
||||
### `typeof`
|
||||
|
||||
Based on JavaScript `typeof` operation.
|
||||
|
||||
The value of the keyword should be a string (`"undefined"`, `"string"`, `"number"`, `"object"`, `"function"`, `"boolean"` or `"symbol"`) or array of strings.
|
||||
|
||||
To pass validation the result of `typeof` operation on the value should be equal to the string (or one of the strings in the array).
|
||||
|
||||
```
|
||||
ajv.validate({ typeof: 'undefined' }, undefined); // true
|
||||
ajv.validate({ typeof: 'undefined' }, null); // false
|
||||
ajv.validate({ typeof: ['undefined', 'object'] }, null); // true
|
||||
```
|
||||
|
||||
|
||||
### `instanceof`
|
||||
|
||||
Based on JavaScript `instanceof` operation.
|
||||
|
||||
The value of the keyword should be a string (`"Object"`, `"Array"`, `"Function"`, `"Number"`, `"String"`, `"Date"`, `"RegExp"`, `"Promise"` or `"Buffer"`) or array of strings.
|
||||
|
||||
To pass validation the result of `data instanceof ...` operation on the value should be true:
|
||||
|
||||
```
|
||||
ajv.validate({ instanceof: 'Array' }, []); // true
|
||||
ajv.validate({ instanceof: 'Array' }, {}); // false
|
||||
ajv.validate({ instanceof: ['Array', 'Function'] }, function(){}); // true
|
||||
```
|
||||
|
||||
You can add your own constructor function to be recognised by this keyword:
|
||||
|
||||
```javascript
|
||||
function MyClass() {}
|
||||
var instanceofDefinition = require('ajv-keywords').get('instanceof').definition;
|
||||
// or require('ajv-keywords/keywords/instanceof').definition;
|
||||
instanceofDefinition.CONSTRUCTORS.MyClass = MyClass;
|
||||
|
||||
ajv.validate({ instanceof: 'MyClass' }, new MyClass); // true
|
||||
```
|
||||
|
||||
|
||||
### `range` and `exclusiveRange`
|
||||
|
||||
Syntax sugar for the combination of minimum and maximum keywords, also fails schema compilation if there are no numbers in the range.
|
||||
|
||||
The value of this keyword must be the array consisting of two numbers, the second must be greater or equal than the first one.
|
||||
|
||||
If the validated value is not a number the validation passes, otherwise to pass validation the value should be greater (or equal) than the first number and smaller (or equal) than the second number in the array. If `exclusiveRange` keyword is present in the same schema and its value is true, the validated value must not be equal to the range boundaries.
|
||||
|
||||
```javascript
|
||||
var schema = { range: [1, 3] };
|
||||
ajv.validate(schema, 1); // true
|
||||
ajv.validate(schema, 2); // true
|
||||
ajv.validate(schema, 3); // true
|
||||
ajv.validate(schema, 0.99); // false
|
||||
ajv.validate(schema, 3.01); // false
|
||||
|
||||
var schema = { range: [1, 3], exclusiveRange: true };
|
||||
ajv.validate(schema, 1.01); // true
|
||||
ajv.validate(schema, 2); // true
|
||||
ajv.validate(schema, 2.99); // true
|
||||
ajv.validate(schema, 1); // false
|
||||
ajv.validate(schema, 3); // false
|
||||
```
|
||||
|
||||
|
||||
### `switch`
|
||||
|
||||
This keyword allows to perform advanced conditional validation.
|
||||
|
||||
The value of the keyword is the array of if/then clauses. Each clause is the object with the following properties:
|
||||
|
||||
- `if` (optional) - the value is JSON-schema
|
||||
- `then` (required) - the value is JSON-schema or boolean
|
||||
- `continue` (optional) - the value is boolean
|
||||
|
||||
The validation process is dynamic; all clauses are executed sequentially in the following way:
|
||||
|
||||
1. `if`:
|
||||
1. `if` property is JSON-schema according to which the data is:
|
||||
1. valid => go to step 2.
|
||||
2. invalid => go to the NEXT clause, if this was the last clause the validation of `switch` SUCCEEDS.
|
||||
2. `if` property is absent => go to step 2.
|
||||
2. `then`:
|
||||
1. `then` property is `true` or it is JSON-schema according to which the data is valid => go to step 3.
|
||||
2. `then` property is `false` or it is JSON-schema according to which the data is invalid => the validation of `switch` FAILS.
|
||||
3. `continue`:
|
||||
1. `continue` property is `true` => go to the NEXT clause, if this was the last clause the validation of `switch` SUCCEEDS.
|
||||
2. `continue` property is `false` or absent => validation of `switch` SUCCEEDS.
|
||||
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, 'switch');
|
||||
|
||||
var schema = {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'integer',
|
||||
'switch': [
|
||||
{ if: { not: { minimum: 1 } }, then: false },
|
||||
{ if: { maximum: 10 }, then: true },
|
||||
{ if: { maximum: 100 }, then: { multipleOf: 10 } },
|
||||
{ if: { maximum: 1000 }, then: { multipleOf: 100 } },
|
||||
{ then: false }
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
var validItems = [1, 5, 10, 20, 50, 100, 200, 500, 1000];
|
||||
|
||||
var invalidItems = [1, 0, 2000, 11, 57, 123, 'foo'];
|
||||
```
|
||||
|
||||
__Please note__: this keyword is moved here from Ajv, mainly to preserve backward compatibility. It is unlikely to become a standard. It's preferable to use `if`/`then`/`else` keywords if possible, as they are likely to be added to the standard. The above schema is equivalent to (for example):
|
||||
|
||||
```javascript
|
||||
{
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'integer',
|
||||
if: { minimum: 1, maximum: 10 },
|
||||
then: true,
|
||||
else: {
|
||||
if: { maximum: 100 },
|
||||
then: { multipleOf: 10 },
|
||||
else: {
|
||||
if: { maximum: 1000 },
|
||||
then: { multipleOf: 100 },
|
||||
else: false
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
|
||||
### `select`/`selectCases`/`selectDefault`
|
||||
|
||||
These keywords allow to choose the schema to validate the data based on the value of some property in the validated data.
|
||||
|
||||
These keywords must be present in the same schema object (`selectDefault` is optional).
|
||||
|
||||
The value of `select` keyword should be a [$data reference](https://github.com/epoberezkin/ajv/tree/5.0.2-beta.0#data-reference) that points to any primitive JSON type (string, number, boolean or null) in the data that is validated. You can also use a constant of primitive type as the value of this keyword (e.g., for debugging purposes).
|
||||
|
||||
The value of `selectCases` keyword must be an object where each property name is a possible string representation of the value of `select` keyword and each property value is a corresponding schema (from draft-06 it can be boolean) that must be used to validate the data.
|
||||
|
||||
The value of `selectDefault` keyword is a schema (from draft-06 it can be boolean) that must be used to validate the data in case `selectCases` has no key equal to the stringified value of `select` keyword.
|
||||
|
||||
The validation succeeds in one of the following cases:
|
||||
- the validation of data using selected schema succeeds,
|
||||
- none of the schemas is selected for validation,
|
||||
- the value of select is undefined (no property in the data that the data reference points to).
|
||||
|
||||
If `select` value (in data) is not a primitive type the validation fails.
|
||||
|
||||
__Please note__: these keywords require Ajv `$data` option to support [$data reference](https://github.com/epoberezkin/ajv/tree/5.0.2-beta.0#data-reference).
|
||||
|
||||
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, 'select');
|
||||
|
||||
var schema = {
|
||||
type: object,
|
||||
required: ['kind'],
|
||||
properties: {
|
||||
kind: { type: 'string' }
|
||||
},
|
||||
select: { $data: '0/kind' },
|
||||
selectCases: {
|
||||
foo: {
|
||||
required: ['foo'],
|
||||
properties: {
|
||||
kind: {},
|
||||
foo: { type: 'string' }
|
||||
},
|
||||
additionalProperties: false
|
||||
},
|
||||
bar: {
|
||||
required: ['bar'],
|
||||
properties: {
|
||||
kind: {},
|
||||
bar: { type: 'number' }
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
},
|
||||
selectDefault: {
|
||||
propertyNames: {
|
||||
not: { enum: ['foo', 'bar'] }
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var validDataList = [
|
||||
{ kind: 'foo', foo: 'any' },
|
||||
{ kind: 'bar', bar: 1 },
|
||||
{ kind: 'anything_else', not_bar_or_foo: 'any value' }
|
||||
];
|
||||
|
||||
var invalidDataList = [
|
||||
{ kind: 'foo' }, // no propery foo
|
||||
{ kind: 'bar' }, // no propery bar
|
||||
{ kind: 'foo', foo: 'any', another: 'any value' }, // additional property
|
||||
{ kind: 'bar', bar: 1, another: 'any value' }, // additional property
|
||||
{ kind: 'anything_else', foo: 'any' } // property foo not allowed
|
||||
{ kind: 'anything_else', bar: 1 } // property bar not allowed
|
||||
];
|
||||
```
|
||||
|
||||
__Please note__: the current implementation is BETA. It does not allow using relative URIs in $ref keywords in schemas in `selectCases` and `selectDefault` that point outside of these schemas. The workaround is to use absolute URIs (that can point to any (sub-)schema added to Ajv, including those inside the current root schema where `select` is used). See [tests](https://github.com/epoberezkin/ajv-keywords/blob/v2.0.0/spec/tests/select.json#L314).
|
||||
|
||||
|
||||
### `patternRequired`
|
||||
|
||||
This keyword allows to require the presence of properties that match some pattern(s).
|
||||
|
||||
This keyword applies only to objects. If the data is not an object, the validation succeeds.
|
||||
|
||||
The value of this keyword should be an array of strings, each string being a regular expression. For data object to be valid each regular expression in this array should match at least one property name in the data object.
|
||||
|
||||
If the array contains multiple regular expressions, more than one expression can match the same property name.
|
||||
|
||||
```javascript
|
||||
var schema = { patternRequired: [ 'f.*o', 'b.*r' ] };
|
||||
|
||||
var validData = { foo: 1, bar: 2 };
|
||||
var alsoValidData = { foobar: 3 };
|
||||
|
||||
var invalidDataList = [ {}, { foo: 1 }, { bar: 2 } ];
|
||||
```
|
||||
|
||||
|
||||
### `prohibited`
|
||||
|
||||
This keyword allows to prohibit that any of the properties in the list is present in the object.
|
||||
|
||||
This keyword applies only to objects. If the data is not an object, the validation succeeds.
|
||||
|
||||
The value of this keyword should be an array of strings, each string being a property name. For data object to be valid none of the properties in this array should be present in the object.
|
||||
|
||||
```
|
||||
var schema = { prohibited: ['foo', 'bar']};
|
||||
|
||||
var validData = { baz: 1 };
|
||||
var alsoValidData = {};
|
||||
|
||||
var invalidDataList = [
|
||||
{ foo: 1 },
|
||||
{ bar: 2 },
|
||||
{ foo: 1, bar: 2}
|
||||
];
|
||||
```
|
||||
|
||||
|
||||
### `deepProperties`
|
||||
|
||||
This keyword allows to validate deep properties (identified by JSON pointers).
|
||||
|
||||
This keyword applies only to objects. If the data is not an object, the validation succeeds.
|
||||
|
||||
The value should be an object, where keys are JSON pointers to the data, starting from the current position in data, and the values are JSON schemas. For data object to be valid the value of each JSON pointer should be valid according to the corresponding schema.
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
type: 'object',
|
||||
deepProperties: {
|
||||
"/users/1/role": { "enum": ["admin"] }
|
||||
}
|
||||
};
|
||||
|
||||
var validData = {
|
||||
users: [
|
||||
{},
|
||||
{
|
||||
id: 123,
|
||||
role: 'admin'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var alsoValidData = {
|
||||
users: {
|
||||
"1": {
|
||||
id: 123,
|
||||
role: 'admin'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var invalidData = {
|
||||
users: [
|
||||
{},
|
||||
{
|
||||
id: 123,
|
||||
role: 'user'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var alsoInvalidData = {
|
||||
users: {
|
||||
"1": {
|
||||
id: 123,
|
||||
role: 'user'
|
||||
}
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
### `deepRequired`
|
||||
|
||||
This keyword allows to check that some deep properties (identified by JSON pointers) are available.
|
||||
|
||||
This keyword applies only to objects. If the data is not an object, the validation succeeds.
|
||||
|
||||
The value should be an array of JSON pointers to the data, starting from the current position in data. For data object to be valid each JSON pointer should be some existing part of the data.
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
type: 'object',
|
||||
deepRequired: ["/users/1/role"]
|
||||
};
|
||||
|
||||
var validData = {
|
||||
users: [
|
||||
{},
|
||||
{
|
||||
id: 123,
|
||||
role: 'admin'
|
||||
}
|
||||
]
|
||||
};
|
||||
|
||||
var invalidData = {
|
||||
users: [
|
||||
{},
|
||||
{
|
||||
id: 123
|
||||
}
|
||||
]
|
||||
};
|
||||
```
|
||||
|
||||
See [json-schema-org/json-schema-spec#203](https://github.com/json-schema-org/json-schema-spec/issues/203#issue-197211916) for an example of the equivalent schema without `deepRequired` keyword.
|
||||
|
||||
|
||||
### `uniqueItemProperties`
|
||||
|
||||
The keyword allows to check that some properties in array items are unique.
|
||||
|
||||
This keyword applies only to arrays. If the data is not an array, the validation succeeds.
|
||||
|
||||
The value of this keyword must be an array of strings - property names that should have unique values across all items.
|
||||
|
||||
```javascript
|
||||
var schema = { uniqueItemProperties: [ "id", "name" ] };
|
||||
|
||||
var validData = [
|
||||
{ id: 1 },
|
||||
{ id: 2 },
|
||||
{ id: 3 }
|
||||
];
|
||||
|
||||
var invalidData1 = [
|
||||
{ id: 1 },
|
||||
{ id: 1 },
|
||||
{ id: 3 }
|
||||
];
|
||||
|
||||
var invalidData2 = [
|
||||
{ id: 1, name: "taco" },
|
||||
{ id: 2, name: "taco" }, // duplicate "name"
|
||||
{ id: 3, name: "salsa" }
|
||||
];
|
||||
```
|
||||
|
||||
This keyword is contributed by [@blainesch](https://github.com/blainesch).
|
||||
|
||||
|
||||
### `regexp`
|
||||
|
||||
This keyword allows to use regular expressions with flags in schemas (the standard `pattern` keyword does not support flags).
|
||||
|
||||
This keyword applies only to strings. If the data is not a string, the validation succeeds.
|
||||
|
||||
The value of this keyword can be either a string (the result of `regexp.toString()`) or an object with the properties `pattern` and `flags` (the same strings that should be passed to RegExp constructor).
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
type: 'object',
|
||||
properties: {
|
||||
foo: { regexp: '/foo/i' },
|
||||
bar: { regexp: { pattern: 'bar', flags: 'i' } }
|
||||
}
|
||||
};
|
||||
|
||||
var validData = {
|
||||
foo: 'Food',
|
||||
bar: 'Barmen'
|
||||
};
|
||||
|
||||
var invalidData = {
|
||||
foo: 'fog',
|
||||
bar: 'bad'
|
||||
};
|
||||
```
|
||||
|
||||
|
||||
### `formatMaximum` / `formatMinimum` and `formatExclusiveMaximum` / `formatExclusiveMinimum`
|
||||
|
||||
These keywords allow to define minimum/maximum constraints when the format keyword defines ordering.
|
||||
|
||||
These keywords apply only to strings. If the data is not a string, the validation succeeds.
|
||||
|
||||
The value of keyword `formatMaximum` (`formatMinimum`) should be a string. This value is the maximum (minimum) allowed value for the data to be valid as determined by `format` keyword.
|
||||
|
||||
When this keyword is added, it defines comparison rules for formats `"date"`, `"time"` and `"date-time". Custom formats also can have comparison rules. See [addFormat](https://github.com/epoberezkin/ajv#api-addformat) method.
|
||||
|
||||
The value of keyword `formatExclusiveMaximum` (`formatExclusiveMinimum`) should be a boolean value. These keyword cannot be used without `formatMaximum` (`formatMinimum`). If this keyword value is equal to `true`, the data to be valid should not be equal to the value in `formatMaximum` (`formatMinimum`) keyword.
|
||||
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, ['formatMinimum', 'formatMaximum']);
|
||||
|
||||
var schema = {
|
||||
format: 'date',
|
||||
formatMinimum: '2016-02-06',
|
||||
formatMaximum: '2016-12-27',
|
||||
formatExclusiveMaximum: true
|
||||
}
|
||||
|
||||
var validDataList = ['2016-02-06', '2016-12-26', 1];
|
||||
|
||||
var invalidDataList = ['2016-02-05', '2016-12-27', 'abc'];
|
||||
```
|
||||
|
||||
|
||||
### `dynamicDefaults`
|
||||
|
||||
This keyword allows to assign dynamic defaults to properties, such as timestamps, unique IDs etc.
|
||||
|
||||
This keyword only works if `useDefaults` options is used and not inside `anyOf` keywrods etc., in the same way as [default keyword treated by Ajv](https://github.com/epoberezkin/ajv#assigning-defaults).
|
||||
|
||||
The keyword should be added on the object level. Its value should be an object with each property corresponding to a property name, in the same way as in standard `properties` keyword. The value of each property can be:
|
||||
|
||||
- an identifier of default function (a string)
|
||||
- an object with properties `func` (an identifier) and `args` (an object with parameters that will be passed to this function during schema compilation - see examples).
|
||||
|
||||
The properties used in `dynamicDefaults` should not be added to `required` keyword (or validation will fail), because unlike `default` this keyword is processed after validation.
|
||||
|
||||
There are several predefined dynamic default functions:
|
||||
|
||||
- `"timestamp"` - current timestamp in milliseconds
|
||||
- `"datetime"` - current date and time as string (ISO, valid according to `date-time` format)
|
||||
- `"date"` - current date as string (ISO, valid according to `date` format)
|
||||
- `"time"` - current time as string (ISO, valid according to `time` format)
|
||||
- `"random"` - pseudo-random number in [0, 1) interval
|
||||
- `"randomint"` - pseudo-random integer number. If string is used as a property value, the function will randomly return 0 or 1. If object `{func: 'randomint', max: N}` is used then the default will be an integer number in [0, N) interval.
|
||||
- `"seq"` - sequential integer number starting from 0. If string is used as a property value, the default sequence will be used. If object `{func: 'seq', name: 'foo'}` is used then the sequence with name `"foo"` will be used. Sequences are global, even if different ajv instances are used.
|
||||
|
||||
```javascript
|
||||
var schema = {
|
||||
type: 'object',
|
||||
dynamicDefaults: {
|
||||
ts: 'datetime',
|
||||
r: { func: 'randomint', max: 100 },
|
||||
id: { func: 'seq', name: 'id' }
|
||||
},
|
||||
properties: {
|
||||
ts: {
|
||||
type: 'string',
|
||||
format: 'datetime'
|
||||
},
|
||||
r: {
|
||||
type: 'integer',
|
||||
minimum: 0,
|
||||
maximum: 100,
|
||||
exclusiveMaximum: true
|
||||
},
|
||||
id: {
|
||||
type: 'integer',
|
||||
minimum: 0
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
var data = {};
|
||||
ajv.validate(data); // true
|
||||
data; // { ts: '2016-12-01T22:07:28.829Z', r: 25, id: 0 }
|
||||
|
||||
var data1 = {};
|
||||
ajv.validate(data1); // true
|
||||
data1; // { ts: '2016-12-01T22:07:29.832Z', r: 68, id: 1 }
|
||||
|
||||
ajv.validate(data1); // true
|
||||
data1; // didn't change, as all properties were defined
|
||||
```
|
||||
|
||||
You can add your own dynamic default function to be recognised by this keyword:
|
||||
|
||||
```javascript
|
||||
var uuid = require('uuid');
|
||||
|
||||
function uuidV4() { return uuid.v4(); }
|
||||
|
||||
var definition = require('ajv-keywords').get('dynamicDefaults').definition;
|
||||
// or require('ajv-keywords/keywords/dynamicDefaults').definition;
|
||||
definition.DEFAULTS.uuid = uuidV4;
|
||||
|
||||
var schema = {
|
||||
dynamicDefaults: { id: 'uuid' },
|
||||
properties: { id: { type: 'string', format: 'uuid' } }
|
||||
};
|
||||
|
||||
var data = {};
|
||||
ajv.validate(schema, data); // true
|
||||
data; // { id: 'a1183fbe-697b-4030-9bcc-cfeb282a9150' };
|
||||
|
||||
var data1 = {};
|
||||
ajv.validate(schema, data1); // true
|
||||
data1; // { id: '5b008de7-1669-467a-a5c6-70fa244d7209' }
|
||||
```
|
||||
|
||||
You also can define dynamic default that accepts parameters, e.g. version of uuid:
|
||||
|
||||
```javascript
|
||||
var uuid = require('uuid');
|
||||
|
||||
function getUuid(args) {
|
||||
var version = 'v' + (arvs && args.v || 4);
|
||||
return function() {
|
||||
return uuid[version]();
|
||||
};
|
||||
}
|
||||
|
||||
var definition = require('ajv-keywords').get('dynamicDefaults').definition;
|
||||
definition.DEFAULTS.uuid = getUuid;
|
||||
|
||||
var schema = {
|
||||
dynamicDefaults: {
|
||||
id1: 'uuid', // v4
|
||||
id2: { func: 'uuid', v: 4 }, // v4
|
||||
id3: { func: 'uuid', v: 1 } // v1
|
||||
}
|
||||
};
|
||||
```
|
||||
|
||||
### `transform`
|
||||
|
||||
This keyword allows a string to be modified before validation.
|
||||
|
||||
These keywords apply only to strings. If the data is not a string, the transform is skipped.
|
||||
|
||||
There are limitation due to how ajv is written:
|
||||
- a stand alone string cannot be transformed. ie `data = 'a'; ajv.validate(schema, data);`
|
||||
- currently cannot work with `ajv-pack`
|
||||
|
||||
**Supported options:**
|
||||
- `trim`: remove whitespace from start and end
|
||||
- `trimLeft`: remove whitespace from start
|
||||
- `trimRight`: remove whitespace from end
|
||||
- `toLowerCase`: case string to all lower case
|
||||
- `toUpperCase`: case string to all upper case
|
||||
- `toEnumCase`: case string to match case in schema
|
||||
|
||||
Options are applied in the order they are listed.
|
||||
|
||||
Note: `toEnumCase` requires that all allowed values are unique when case insensitive.
|
||||
|
||||
**Example: multiple options**
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, ['transform']);
|
||||
|
||||
var schema = {
|
||||
type: 'array',
|
||||
items: {
|
||||
type:'string',
|
||||
transform:['trim','lowercase']
|
||||
}
|
||||
};
|
||||
|
||||
var data = [' MixCase '];
|
||||
avj.validate(schema, data);
|
||||
console.log(data); // ['mixcase']
|
||||
|
||||
```
|
||||
|
||||
**Example: `enumcase`**
|
||||
```javascript
|
||||
require('ajv-keywords')(ajv, ['transform']);
|
||||
|
||||
var schema = {
|
||||
type: 'array',
|
||||
items: {
|
||||
type:'string',
|
||||
transform:['trim','enumcase'],
|
||||
enum:['pH']
|
||||
}
|
||||
};
|
||||
|
||||
var data = ['ph',' Ph','PH','pH '];
|
||||
avj.validate(schema, data);
|
||||
console.log(data); // ['pH','pH','pH','pH']
|
||||
```
|
||||
|
||||
|
||||
## License
|
||||
|
||||
[MIT](https://github.com/epoberezkin/ajv-keywords/blob/master/LICENSE)
|
35
tools/node_modules/eslint/node_modules/ajv-keywords/index.js
generated
vendored
35
tools/node_modules/eslint/node_modules/ajv-keywords/index.js
generated
vendored
@ -1,35 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var KEYWORDS = require('./keywords');
|
||||
|
||||
module.exports = defineKeywords;
|
||||
|
||||
|
||||
/**
|
||||
* Defines one or several keywords in ajv instance
|
||||
* @param {Ajv} ajv validator instance
|
||||
* @param {String|Array<String>|undefined} keyword keyword(s) to define
|
||||
* @return {Ajv} ajv instance (for chaining)
|
||||
*/
|
||||
function defineKeywords(ajv, keyword) {
|
||||
if (Array.isArray(keyword)) {
|
||||
for (var i=0; i<keyword.length; i++)
|
||||
get(keyword[i])(ajv);
|
||||
return ajv;
|
||||
}
|
||||
if (keyword) {
|
||||
get(keyword)(ajv);
|
||||
return ajv;
|
||||
}
|
||||
for (keyword in KEYWORDS) get(keyword)(ajv);
|
||||
return ajv;
|
||||
}
|
||||
|
||||
|
||||
defineKeywords.get = get;
|
||||
|
||||
function get(keyword) {
|
||||
var defFunc = KEYWORDS[keyword];
|
||||
if (!defFunc) throw new Error('Unknown keyword ' + keyword);
|
||||
return defFunc;
|
||||
}
|
90
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/_formatLimit.js
generated
vendored
90
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/_formatLimit.js
generated
vendored
@ -1,90 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var TIME = /^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i;
|
||||
var DATE_TIME_SEPARATOR = /t|\s/i;
|
||||
|
||||
var COMPARE_FORMATS = {
|
||||
date: compareDate,
|
||||
time: compareTime,
|
||||
'date-time': compareDateTime
|
||||
};
|
||||
|
||||
module.exports = function (minMax) {
|
||||
var keyword = 'format' + minMax;
|
||||
return function defFunc(ajv) {
|
||||
defFunc.definition = {
|
||||
type: 'string',
|
||||
inline: require('./dotjs/_formatLimit'),
|
||||
statements: true,
|
||||
errors: 'full',
|
||||
metaSchema: {
|
||||
anyOf: [
|
||||
{ type: 'string' },
|
||||
{
|
||||
type: 'object',
|
||||
required: [ '$data' ],
|
||||
properties: {
|
||||
$data: {
|
||||
type: 'string',
|
||||
anyOf: [
|
||||
{ format: 'relative-json-pointer' },
|
||||
{ format: 'json-pointer' }
|
||||
]
|
||||
}
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword(keyword, defFunc.definition);
|
||||
ajv.addKeyword('formatExclusive' + minMax);
|
||||
extendFormats(ajv);
|
||||
return ajv;
|
||||
};
|
||||
};
|
||||
|
||||
|
||||
function extendFormats(ajv) {
|
||||
var formats = ajv._formats;
|
||||
for (var name in COMPARE_FORMATS) {
|
||||
var format = formats[name];
|
||||
// the last condition is needed if it's RegExp from another window
|
||||
if (typeof format != 'object' || format instanceof RegExp || !format.validate)
|
||||
format = formats[name] = { validate: format };
|
||||
if (!format.compare)
|
||||
format.compare = COMPARE_FORMATS[name];
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
function compareDate(d1, d2) {
|
||||
if (!(d1 && d2)) return;
|
||||
if (d1 > d2) return 1;
|
||||
if (d1 < d2) return -1;
|
||||
if (d1 === d2) return 0;
|
||||
}
|
||||
|
||||
|
||||
function compareTime(t1, t2) {
|
||||
if (!(t1 && t2)) return;
|
||||
t1 = t1.match(TIME);
|
||||
t2 = t2.match(TIME);
|
||||
if (!(t1 && t2)) return;
|
||||
t1 = t1[1] + t1[2] + t1[3] + (t1[4]||'');
|
||||
t2 = t2[1] + t2[2] + t2[3] + (t2[4]||'');
|
||||
if (t1 > t2) return 1;
|
||||
if (t1 < t2) return -1;
|
||||
if (t1 === t2) return 0;
|
||||
}
|
||||
|
||||
|
||||
function compareDateTime(dt1, dt2) {
|
||||
if (!(dt1 && dt2)) return;
|
||||
dt1 = dt1.split(DATE_TIME_SEPARATOR);
|
||||
dt2 = dt2.split(DATE_TIME_SEPARATOR);
|
||||
var res = compareDate(dt1[0], dt2[0]);
|
||||
if (res === undefined) return;
|
||||
return res || compareTime(dt1[1], dt2[1]);
|
||||
}
|
15
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/_util.js
generated
vendored
15
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/_util.js
generated
vendored
@ -1,15 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
metaSchemaRef: metaSchemaRef
|
||||
};
|
||||
|
||||
var META_SCHEMA_ID = 'http://json-schema.org/draft-06/schema';
|
||||
|
||||
function metaSchemaRef(ajv) {
|
||||
var defaultMeta = ajv._opts.defaultMeta;
|
||||
if (typeof defaultMeta == 'string') return { $ref: defaultMeta };
|
||||
if (ajv.getSchema(META_SCHEMA_ID)) return { $ref: META_SCHEMA_ID };
|
||||
console.warn('meta schema not defined');
|
||||
return {};
|
||||
}
|
54
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/deepProperties.js
generated
vendored
54
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/deepProperties.js
generated
vendored
@ -1,54 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('./_util');
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
defFunc.definition = {
|
||||
type: 'object',
|
||||
macro: function (schema) {
|
||||
var schemas = [];
|
||||
for (var pointer in schema)
|
||||
schemas.push(getSchema(pointer, schema[pointer]));
|
||||
return { 'allOf': schemas };
|
||||
},
|
||||
metaSchema: {
|
||||
type: 'object',
|
||||
propertyNames: {
|
||||
type: 'string',
|
||||
format: 'json-pointer'
|
||||
},
|
||||
additionalProperties: util.metaSchemaRef(ajv)
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('deepProperties', defFunc.definition);
|
||||
return ajv;
|
||||
};
|
||||
|
||||
|
||||
function getSchema(jsonPointer, schema) {
|
||||
var segments = jsonPointer.split('/');
|
||||
var rootSchema = {};
|
||||
var pointerSchema = rootSchema;
|
||||
for (var i=1; i<segments.length; i++) {
|
||||
var segment = segments[i];
|
||||
var isLast = i == segments.length - 1;
|
||||
segment = unescapeJsonPointer(segment);
|
||||
var properties = pointerSchema.properties = {};
|
||||
var items = undefined;
|
||||
if (/[0-9]+/.test(segment)) {
|
||||
var count = +segment;
|
||||
items = pointerSchema.items = [];
|
||||
while (count--) items.push({});
|
||||
}
|
||||
pointerSchema = isLast ? schema : {};
|
||||
properties[segment] = pointerSchema;
|
||||
if (items) items.push(pointerSchema);
|
||||
}
|
||||
return rootSchema;
|
||||
}
|
||||
|
||||
|
||||
function unescapeJsonPointer(str) {
|
||||
return str.replace(/~1/g, '/').replace(/~0/g, '~');
|
||||
}
|
57
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/deepRequired.js
generated
vendored
57
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/deepRequired.js
generated
vendored
@ -1,57 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
defFunc.definition = {
|
||||
type: 'object',
|
||||
inline: function (it, keyword, schema) {
|
||||
var expr = '';
|
||||
for (var i=0; i<schema.length; i++) {
|
||||
if (i) expr += ' && ';
|
||||
expr += '(' + getData(schema[i], it.dataLevel) + ' !== undefined)';
|
||||
}
|
||||
return expr;
|
||||
},
|
||||
metaSchema: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
format: 'json-pointer'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('deepRequired', defFunc.definition);
|
||||
return ajv;
|
||||
};
|
||||
|
||||
|
||||
function getData(jsonPointer, lvl) {
|
||||
var data = 'data' + (lvl || '');
|
||||
if (!jsonPointer) return data;
|
||||
|
||||
var expr = data;
|
||||
var segments = jsonPointer.split('/');
|
||||
for (var i=1; i<segments.length; i++) {
|
||||
var segment = segments[i];
|
||||
data += getProperty(unescapeJsonPointer(segment));
|
||||
expr += ' && ' + data;
|
||||
}
|
||||
return expr;
|
||||
}
|
||||
|
||||
|
||||
var IDENTIFIER = /^[a-z$_][a-z$_0-9]*$/i;
|
||||
var INTEGER = /^[0-9]+$/;
|
||||
var SINGLE_QUOTE = /'|\\/g;
|
||||
function getProperty(key) {
|
||||
return INTEGER.test(key)
|
||||
? '[' + key + ']'
|
||||
: IDENTIFIER.test(key)
|
||||
? '.' + key
|
||||
: "['" + key.replace(SINGLE_QUOTE, '\\$&') + "']";
|
||||
}
|
||||
|
||||
|
||||
function unescapeJsonPointer(str) {
|
||||
return str.replace(/~1/g, '/').replace(/~0/g, '~');
|
||||
}
|
116
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dot/_formatLimit.jst
generated
vendored
116
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dot/_formatLimit.jst
generated
vendored
@ -1,116 +0,0 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
var {{=$valid}} = undefined;
|
||||
|
||||
{{## def.skipFormatLimit:
|
||||
{{=$valid}} = true;
|
||||
{{ return out; }}
|
||||
#}}
|
||||
|
||||
{{## def.compareFormat:
|
||||
{{? $isData }}
|
||||
if ({{=$schemaValue}} === undefined) {{=$valid}} = true;
|
||||
else if (typeof {{=$schemaValue}} != 'string') {{=$valid}} = false;
|
||||
else {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
|
||||
{{? $isDataFormat }}
|
||||
if (!{{=$compare}}) {{=$valid}} = true;
|
||||
else {
|
||||
{{ $closingBraces += '}'; }}
|
||||
{{?}}
|
||||
|
||||
var {{=$result}} = {{=$compare}}({{=$data}}, {{# def.schemaValueQS }});
|
||||
|
||||
if ({{=$result}} === undefined) {{=$valid}} = false;
|
||||
#}}
|
||||
|
||||
|
||||
{{? it.opts.format === false }}{{# def.skipFormatLimit }}{{?}}
|
||||
|
||||
{{
|
||||
var $schemaFormat = it.schema.format
|
||||
, $isDataFormat = it.opts.$data && $schemaFormat.$data
|
||||
, $closingBraces = '';
|
||||
}}
|
||||
|
||||
{{? $isDataFormat }}
|
||||
{{
|
||||
var $schemaValueFormat = it.util.getData($schemaFormat.$data, $dataLvl, it.dataPathArr)
|
||||
, $format = 'format' + $lvl
|
||||
, $compare = 'compare' + $lvl;
|
||||
}}
|
||||
|
||||
var {{=$format}} = formats[{{=$schemaValueFormat}}]
|
||||
, {{=$compare}} = {{=$format}} && {{=$format}}.compare;
|
||||
{{??}}
|
||||
{{ var $format = it.formats[$schemaFormat]; }}
|
||||
{{? !($format && $format.compare) }}
|
||||
{{# def.skipFormatLimit }}
|
||||
{{?}}
|
||||
{{ var $compare = 'formats' + it.util.getProperty($schemaFormat) + '.compare'; }}
|
||||
{{?}}
|
||||
|
||||
{{
|
||||
var $isMax = $keyword == 'formatMaximum'
|
||||
, $exclusiveKeyword = 'formatExclusive' + ($isMax ? 'Maximum' : 'Minimum')
|
||||
, $schemaExcl = it.schema[$exclusiveKeyword]
|
||||
, $isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data
|
||||
, $op = $isMax ? '<' : '>'
|
||||
, $result = 'result' + $lvl;
|
||||
}}
|
||||
|
||||
{{# def.$data }}
|
||||
|
||||
|
||||
{{? $isDataExcl }}
|
||||
{{
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr)
|
||||
, $exclusive = 'exclusive' + $lvl
|
||||
, $opExpr = 'op' + $lvl
|
||||
, $opStr = '\' + ' + $opExpr + ' + \'';
|
||||
}}
|
||||
var schemaExcl{{=$lvl}} = {{=$schemaValueExcl}};
|
||||
{{ $schemaValueExcl = 'schemaExcl' + $lvl; }}
|
||||
|
||||
if (typeof {{=$schemaValueExcl}} != 'boolean' && {{=$schemaValueExcl}} !== undefined) {
|
||||
{{=$valid}} = false;
|
||||
{{ var $errorKeyword = $exclusiveKeyword; }}
|
||||
{{# def.error:'_formatExclusiveLimit' }}
|
||||
}
|
||||
|
||||
{{# def.elseIfValid }}
|
||||
|
||||
{{# def.compareFormat }}
|
||||
var {{=$exclusive}} = {{=$schemaValueExcl}} === true;
|
||||
|
||||
if ({{=$valid}} === undefined) {
|
||||
{{=$valid}} = {{=$exclusive}}
|
||||
? {{=$result}} {{=$op}} 0
|
||||
: {{=$result}} {{=$op}}= 0;
|
||||
}
|
||||
|
||||
if (!{{=$valid}}) var op{{=$lvl}} = {{=$exclusive}} ? '{{=$op}}' : '{{=$op}}=';
|
||||
{{??}}
|
||||
{{
|
||||
var $exclusive = $schemaExcl === true
|
||||
, $opStr = $op; /*used in error*/
|
||||
if (!$exclusive) $opStr += '=';
|
||||
var $opExpr = '\'' + $opStr + '\''; /*used in error*/
|
||||
}}
|
||||
|
||||
{{# def.compareFormat }}
|
||||
|
||||
if ({{=$valid}} === undefined)
|
||||
{{=$valid}} = {{=$result}} {{=$op}}{{?!$exclusive}}={{?}} 0;
|
||||
{{?}}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
if (!{{=$valid}}) {
|
||||
{{ var $errorKeyword = $keyword; }}
|
||||
{{# def.error:'_formatLimit' }}
|
||||
}
|
33
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dot/patternRequired.jst
generated
vendored
33
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dot/patternRequired.jst
generated
vendored
@ -1,33 +0,0 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
|
||||
{{
|
||||
var $key = 'key' + $lvl
|
||||
, $idx = 'idx' + $lvl
|
||||
, $matched = 'patternMatched' + $lvl
|
||||
, $dataProperties = 'dataProperties' + $lvl
|
||||
, $closingBraces = ''
|
||||
, $ownProperties = it.opts.ownProperties;
|
||||
}}
|
||||
|
||||
var {{=$valid}} = true;
|
||||
{{? $ownProperties }}
|
||||
var {{=$dataProperties}} = undefined;
|
||||
{{?}}
|
||||
|
||||
{{~ $schema:$pProperty }}
|
||||
var {{=$matched}} = false;
|
||||
{{# def.iterateProperties }}
|
||||
{{=$matched}} = {{= it.usePattern($pProperty) }}.test({{=$key}});
|
||||
if ({{=$matched}}) break;
|
||||
}
|
||||
|
||||
{{ var $missingPattern = it.util.escapeQuotes($pProperty); }}
|
||||
if (!{{=$matched}}) {
|
||||
{{=$valid}} = false;
|
||||
{{# def.addError:'patternRequired' }}
|
||||
} {{# def.elseIfValid }}
|
||||
{{~}}
|
||||
|
||||
{{= $closingBraces }}
|
73
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dot/switch.jst
generated
vendored
73
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dot/switch.jst
generated
vendored
@ -1,73 +0,0 @@
|
||||
{{# def.definitions }}
|
||||
{{# def.errors }}
|
||||
{{# def.setupKeyword }}
|
||||
{{# def.setupNextLevel }}
|
||||
|
||||
|
||||
{{## def.validateIf:
|
||||
{{# def.setCompositeRule }}
|
||||
{{ $it.createErrors = false; }}
|
||||
{{# def._validateSwitchRule:if }}
|
||||
{{ $it.createErrors = true; }}
|
||||
{{# def.resetCompositeRule }}
|
||||
{{=$ifPassed}} = {{=$nextValid}};
|
||||
#}}
|
||||
|
||||
{{## def.validateThen:
|
||||
{{? typeof $sch.then == 'boolean' }}
|
||||
{{? $sch.then === false }}
|
||||
{{# def.error:'switch' }}
|
||||
{{?}}
|
||||
var {{=$nextValid}} = {{= $sch.then }};
|
||||
{{??}}
|
||||
{{# def._validateSwitchRule:then }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
{{## def._validateSwitchRule:_clause:
|
||||
{{
|
||||
$it.schema = $sch._clause;
|
||||
$it.schemaPath = $schemaPath + '[' + $caseIndex + ']._clause';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/_clause';
|
||||
}}
|
||||
{{# def.insertSubschemaCode }}
|
||||
#}}
|
||||
|
||||
{{## def.switchCase:
|
||||
{{? $sch.if && {{# def.nonEmptySchema:$sch.if }} }}
|
||||
var {{=$errs}} = errors;
|
||||
{{# def.validateIf }}
|
||||
if ({{=$ifPassed}}) {
|
||||
{{# def.validateThen }}
|
||||
} else {
|
||||
{{# def.resetErrors }}
|
||||
}
|
||||
{{??}}
|
||||
{{=$ifPassed}} = true;
|
||||
{{# def.validateThen }}
|
||||
{{?}}
|
||||
#}}
|
||||
|
||||
|
||||
{{
|
||||
var $ifPassed = 'ifPassed' + it.level
|
||||
, $currentBaseId = $it.baseId
|
||||
, $shouldContinue;
|
||||
}}
|
||||
var {{=$ifPassed}};
|
||||
|
||||
{{~ $schema:$sch:$caseIndex }}
|
||||
{{? $caseIndex && !$shouldContinue }}
|
||||
if (!{{=$ifPassed}}) {
|
||||
{{ $closingBraces+= '}'; }}
|
||||
{{?}}
|
||||
|
||||
{{# def.switchCase }}
|
||||
{{ $shouldContinue = $sch.continue }}
|
||||
{{~}}
|
||||
|
||||
{{= $closingBraces }}
|
||||
|
||||
var {{=$valid}} = {{=$nextValid}};
|
||||
|
||||
{{# def.cleanUp }}
|
3
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dotjs/README.md
generated
vendored
3
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dotjs/README.md
generated
vendored
@ -1,3 +0,0 @@
|
||||
These files are compiled dot templates from dot folder.
|
||||
|
||||
Do NOT edit them directly, edit the templates and run `npm run build` from main ajv-keywords folder.
|
176
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dotjs/_formatLimit.js
generated
vendored
176
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dotjs/_formatLimit.js
generated
vendored
@ -1,176 +0,0 @@
|
||||
'use strict';
|
||||
module.exports = function generate__formatLimit(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $errorKeyword;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
out += 'var ' + ($valid) + ' = undefined;';
|
||||
if (it.opts.format === false) {
|
||||
out += ' ' + ($valid) + ' = true; ';
|
||||
return out;
|
||||
}
|
||||
var $schemaFormat = it.schema.format,
|
||||
$isDataFormat = it.opts.$data && $schemaFormat.$data,
|
||||
$closingBraces = '';
|
||||
if ($isDataFormat) {
|
||||
var $schemaValueFormat = it.util.getData($schemaFormat.$data, $dataLvl, it.dataPathArr),
|
||||
$format = 'format' + $lvl,
|
||||
$compare = 'compare' + $lvl;
|
||||
out += ' var ' + ($format) + ' = formats[' + ($schemaValueFormat) + '] , ' + ($compare) + ' = ' + ($format) + ' && ' + ($format) + '.compare;';
|
||||
} else {
|
||||
var $format = it.formats[$schemaFormat];
|
||||
if (!($format && $format.compare)) {
|
||||
out += ' ' + ($valid) + ' = true; ';
|
||||
return out;
|
||||
}
|
||||
var $compare = 'formats' + it.util.getProperty($schemaFormat) + '.compare';
|
||||
}
|
||||
var $isMax = $keyword == 'formatMaximum',
|
||||
$exclusiveKeyword = 'formatExclusive' + ($isMax ? 'Maximum' : 'Minimum'),
|
||||
$schemaExcl = it.schema[$exclusiveKeyword],
|
||||
$isDataExcl = it.opts.$data && $schemaExcl && $schemaExcl.$data,
|
||||
$op = $isMax ? '<' : '>',
|
||||
$result = 'result' + $lvl;
|
||||
var $isData = it.opts.$data && $schema && $schema.$data,
|
||||
$schemaValue;
|
||||
if ($isData) {
|
||||
out += ' var schema' + ($lvl) + ' = ' + (it.util.getData($schema.$data, $dataLvl, it.dataPathArr)) + '; ';
|
||||
$schemaValue = 'schema' + $lvl;
|
||||
} else {
|
||||
$schemaValue = $schema;
|
||||
}
|
||||
if ($isDataExcl) {
|
||||
var $schemaValueExcl = it.util.getData($schemaExcl.$data, $dataLvl, it.dataPathArr),
|
||||
$exclusive = 'exclusive' + $lvl,
|
||||
$opExpr = 'op' + $lvl,
|
||||
$opStr = '\' + ' + $opExpr + ' + \'';
|
||||
out += ' var schemaExcl' + ($lvl) + ' = ' + ($schemaValueExcl) + '; ';
|
||||
$schemaValueExcl = 'schemaExcl' + $lvl;
|
||||
out += ' if (typeof ' + ($schemaValueExcl) + ' != \'boolean\' && ' + ($schemaValueExcl) + ' !== undefined) { ' + ($valid) + ' = false; ';
|
||||
var $errorKeyword = $exclusiveKeyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_formatExclusiveLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: {} ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'' + ($exclusiveKeyword) + ' should be boolean\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += ' } ';
|
||||
if ($breakOnError) {
|
||||
$closingBraces += '}';
|
||||
out += ' else { ';
|
||||
}
|
||||
if ($isData) {
|
||||
out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
if ($isDataFormat) {
|
||||
out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', ';
|
||||
if ($isData) {
|
||||
out += '' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; var ' + ($exclusive) + ' = ' + ($schemaValueExcl) + ' === true; if (' + ($valid) + ' === undefined) { ' + ($valid) + ' = ' + ($exclusive) + ' ? ' + ($result) + ' ' + ($op) + ' 0 : ' + ($result) + ' ' + ($op) + '= 0; } if (!' + ($valid) + ') var op' + ($lvl) + ' = ' + ($exclusive) + ' ? \'' + ($op) + '\' : \'' + ($op) + '=\';';
|
||||
} else {
|
||||
var $exclusive = $schemaExcl === true,
|
||||
$opStr = $op;
|
||||
if (!$exclusive) $opStr += '=';
|
||||
var $opExpr = '\'' + $opStr + '\'';
|
||||
if ($isData) {
|
||||
out += ' if (' + ($schemaValue) + ' === undefined) ' + ($valid) + ' = true; else if (typeof ' + ($schemaValue) + ' != \'string\') ' + ($valid) + ' = false; else { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
if ($isDataFormat) {
|
||||
out += ' if (!' + ($compare) + ') ' + ($valid) + ' = true; else { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
out += ' var ' + ($result) + ' = ' + ($compare) + '(' + ($data) + ', ';
|
||||
if ($isData) {
|
||||
out += '' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' ); if (' + ($result) + ' === undefined) ' + ($valid) + ' = false; if (' + ($valid) + ' === undefined) ' + ($valid) + ' = ' + ($result) + ' ' + ($op);
|
||||
if (!$exclusive) {
|
||||
out += '=';
|
||||
}
|
||||
out += ' 0;';
|
||||
}
|
||||
out += '' + ($closingBraces) + 'if (!' + ($valid) + ') { ';
|
||||
var $errorKeyword = $keyword;
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ($errorKeyword || '_formatLimit') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { comparison: ' + ($opExpr) + ', limit: ';
|
||||
if ($isData) {
|
||||
out += '' + ($schemaValue);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' , exclusive: ' + ($exclusive) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should be ' + ($opStr) + ' "';
|
||||
if ($isData) {
|
||||
out += '\' + ' + ($schemaValue) + ' + \'';
|
||||
} else {
|
||||
out += '' + (it.util.escapeQuotes($schema));
|
||||
}
|
||||
out += '"\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: ';
|
||||
if ($isData) {
|
||||
out += 'validate.schema' + ($schemaPath);
|
||||
} else {
|
||||
out += '' + (it.util.toQuotedString($schema));
|
||||
}
|
||||
out += ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
out += '}';
|
||||
return out;
|
||||
}
|
58
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dotjs/patternRequired.js
generated
vendored
58
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dotjs/patternRequired.js
generated
vendored
@ -1,58 +0,0 @@
|
||||
'use strict';
|
||||
module.exports = function generate_patternRequired(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $key = 'key' + $lvl,
|
||||
$idx = 'idx' + $lvl,
|
||||
$matched = 'patternMatched' + $lvl,
|
||||
$dataProperties = 'dataProperties' + $lvl,
|
||||
$closingBraces = '',
|
||||
$ownProperties = it.opts.ownProperties;
|
||||
out += 'var ' + ($valid) + ' = true;';
|
||||
if ($ownProperties) {
|
||||
out += ' var ' + ($dataProperties) + ' = undefined;';
|
||||
}
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $pProperty, i1 = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while (i1 < l1) {
|
||||
$pProperty = arr1[i1 += 1];
|
||||
out += ' var ' + ($matched) + ' = false; ';
|
||||
if ($ownProperties) {
|
||||
out += ' ' + ($dataProperties) + ' = ' + ($dataProperties) + ' || Object.keys(' + ($data) + '); for (var ' + ($idx) + '=0; ' + ($idx) + '<' + ($dataProperties) + '.length; ' + ($idx) + '++) { var ' + ($key) + ' = ' + ($dataProperties) + '[' + ($idx) + ']; ';
|
||||
} else {
|
||||
out += ' for (var ' + ($key) + ' in ' + ($data) + ') { ';
|
||||
}
|
||||
out += ' ' + ($matched) + ' = ' + (it.usePattern($pProperty)) + '.test(' + ($key) + '); if (' + ($matched) + ') break; } ';
|
||||
var $missingPattern = it.util.escapeQuotes($pProperty);
|
||||
out += ' if (!' + ($matched) + ') { ' + ($valid) + ' = false; var err = '; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('patternRequired') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { missingPattern: \'' + ($missingPattern) + '\' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should have property matching pattern \\\'' + ($missingPattern) + '\\\'\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
out += '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; } ';
|
||||
if ($breakOnError) {
|
||||
$closingBraces += '}';
|
||||
out += ' else { ';
|
||||
}
|
||||
}
|
||||
}
|
||||
out += '' + ($closingBraces);
|
||||
return out;
|
||||
}
|
128
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dotjs/switch.js
generated
vendored
128
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dotjs/switch.js
generated
vendored
@ -1,128 +0,0 @@
|
||||
'use strict';
|
||||
module.exports = function generate_switch(it, $keyword, $ruleType) {
|
||||
var out = ' ';
|
||||
var $lvl = it.level;
|
||||
var $dataLvl = it.dataLevel;
|
||||
var $schema = it.schema[$keyword];
|
||||
var $schemaPath = it.schemaPath + it.util.getProperty($keyword);
|
||||
var $errSchemaPath = it.errSchemaPath + '/' + $keyword;
|
||||
var $breakOnError = !it.opts.allErrors;
|
||||
var $data = 'data' + ($dataLvl || '');
|
||||
var $valid = 'valid' + $lvl;
|
||||
var $errs = 'errs__' + $lvl;
|
||||
var $it = it.util.copy(it);
|
||||
var $closingBraces = '';
|
||||
$it.level++;
|
||||
var $nextValid = 'valid' + $it.level;
|
||||
var $ifPassed = 'ifPassed' + it.level,
|
||||
$currentBaseId = $it.baseId,
|
||||
$shouldContinue;
|
||||
out += 'var ' + ($ifPassed) + ';';
|
||||
var arr1 = $schema;
|
||||
if (arr1) {
|
||||
var $sch, $caseIndex = -1,
|
||||
l1 = arr1.length - 1;
|
||||
while ($caseIndex < l1) {
|
||||
$sch = arr1[$caseIndex += 1];
|
||||
if ($caseIndex && !$shouldContinue) {
|
||||
out += ' if (!' + ($ifPassed) + ') { ';
|
||||
$closingBraces += '}';
|
||||
}
|
||||
if ($sch.if && it.util.schemaHasRules($sch.if, it.RULES.all)) {
|
||||
out += ' var ' + ($errs) + ' = errors; ';
|
||||
var $wasComposite = it.compositeRule;
|
||||
it.compositeRule = $it.compositeRule = true;
|
||||
$it.createErrors = false;
|
||||
$it.schema = $sch.if;
|
||||
$it.schemaPath = $schemaPath + '[' + $caseIndex + '].if';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/if';
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
$it.createErrors = true;
|
||||
it.compositeRule = $it.compositeRule = $wasComposite;
|
||||
out += ' ' + ($ifPassed) + ' = ' + ($nextValid) + '; if (' + ($ifPassed) + ') { ';
|
||||
if (typeof $sch.then == 'boolean') {
|
||||
if ($sch.then === false) {
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should pass "switch" keyword validation\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
}
|
||||
out += ' var ' + ($nextValid) + ' = ' + ($sch.then) + '; ';
|
||||
} else {
|
||||
$it.schema = $sch.then;
|
||||
$it.schemaPath = $schemaPath + '[' + $caseIndex + '].then';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/then';
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
}
|
||||
out += ' } else { errors = ' + ($errs) + '; if (vErrors !== null) { if (' + ($errs) + ') vErrors.length = ' + ($errs) + '; else vErrors = null; } } ';
|
||||
} else {
|
||||
out += ' ' + ($ifPassed) + ' = true; ';
|
||||
if (typeof $sch.then == 'boolean') {
|
||||
if ($sch.then === false) {
|
||||
var $$outStack = $$outStack || [];
|
||||
$$outStack.push(out);
|
||||
out = ''; /* istanbul ignore else */
|
||||
if (it.createErrors !== false) {
|
||||
out += ' { keyword: \'' + ('switch') + '\' , dataPath: (dataPath || \'\') + ' + (it.errorPath) + ' , schemaPath: ' + (it.util.toQuotedString($errSchemaPath)) + ' , params: { caseIndex: ' + ($caseIndex) + ' } ';
|
||||
if (it.opts.messages !== false) {
|
||||
out += ' , message: \'should pass "switch" keyword validation\' ';
|
||||
}
|
||||
if (it.opts.verbose) {
|
||||
out += ' , schema: validate.schema' + ($schemaPath) + ' , parentSchema: validate.schema' + (it.schemaPath) + ' , data: ' + ($data) + ' ';
|
||||
}
|
||||
out += ' } ';
|
||||
} else {
|
||||
out += ' {} ';
|
||||
}
|
||||
var __err = out;
|
||||
out = $$outStack.pop();
|
||||
if (!it.compositeRule && $breakOnError) { /* istanbul ignore if */
|
||||
if (it.async) {
|
||||
out += ' throw new ValidationError([' + (__err) + ']); ';
|
||||
} else {
|
||||
out += ' validate.errors = [' + (__err) + ']; return false; ';
|
||||
}
|
||||
} else {
|
||||
out += ' var err = ' + (__err) + '; if (vErrors === null) vErrors = [err]; else vErrors.push(err); errors++; ';
|
||||
}
|
||||
}
|
||||
out += ' var ' + ($nextValid) + ' = ' + ($sch.then) + '; ';
|
||||
} else {
|
||||
$it.schema = $sch.then;
|
||||
$it.schemaPath = $schemaPath + '[' + $caseIndex + '].then';
|
||||
$it.errSchemaPath = $errSchemaPath + '/' + $caseIndex + '/then';
|
||||
out += ' ' + (it.validate($it)) + ' ';
|
||||
$it.baseId = $currentBaseId;
|
||||
}
|
||||
}
|
||||
$shouldContinue = $sch.continue
|
||||
}
|
||||
}
|
||||
out += '' + ($closingBraces) + 'var ' + ($valid) + ' = ' + ($nextValid) + '; ';
|
||||
out = it.util.cleanUpCode(out);
|
||||
return out;
|
||||
}
|
68
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dynamicDefaults.js
generated
vendored
68
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/dynamicDefaults.js
generated
vendored
@ -1,68 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var sequences = {};
|
||||
|
||||
var DEFAULTS = {
|
||||
timestamp: function() { return Date.now(); },
|
||||
datetime: function() { return (new Date).toISOString(); },
|
||||
date: function() { return (new Date).toISOString().slice(0, 10); },
|
||||
time: function() { return (new Date).toISOString().slice(11); },
|
||||
random: function() { return Math.random(); },
|
||||
randomint: function (args) {
|
||||
var limit = args && args.max || 2;
|
||||
return function() { return Math.floor(Math.random() * limit); };
|
||||
},
|
||||
seq: function (args) {
|
||||
var name = args && args.name || '';
|
||||
sequences[name] = sequences[name] || 0;
|
||||
return function() { return sequences[name]++; };
|
||||
}
|
||||
};
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
defFunc.definition = {
|
||||
compile: function (schema, parentSchema, it) {
|
||||
var funcs = {};
|
||||
|
||||
for (var key in schema) {
|
||||
var d = schema[key];
|
||||
var func = getDefault(typeof d == 'string' ? d : d.func);
|
||||
funcs[key] = func.length ? func(d.args) : func;
|
||||
}
|
||||
|
||||
return it.opts.useDefaults && !it.compositeRule
|
||||
? assignDefaults
|
||||
: noop;
|
||||
|
||||
function assignDefaults(data) {
|
||||
for (var prop in schema)
|
||||
if (data[prop] === undefined) data[prop] = funcs[prop]();
|
||||
return true;
|
||||
}
|
||||
|
||||
function noop() { return true; }
|
||||
},
|
||||
DEFAULTS: DEFAULTS,
|
||||
metaSchema: {
|
||||
type: 'object',
|
||||
additionalProperties: {
|
||||
type: ['string', 'object'],
|
||||
additionalProperties: false,
|
||||
required: ['func', 'args'],
|
||||
properties: {
|
||||
func: { type: 'string' },
|
||||
args: { type: 'object' }
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('dynamicDefaults', defFunc.definition);
|
||||
return ajv;
|
||||
|
||||
function getDefault(d) {
|
||||
var def = DEFAULTS[d];
|
||||
if (def) return def;
|
||||
throw new Error('invalid "dynamicDefaults" keyword property value: ' + d);
|
||||
}
|
||||
};
|
3
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/formatMaximum.js
generated
vendored
3
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/formatMaximum.js
generated
vendored
@ -1,3 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./_formatLimit')('Maximum');
|
3
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/formatMinimum.js
generated
vendored
3
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/formatMinimum.js
generated
vendored
@ -1,3 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = require('./_formatLimit')('Minimum');
|
19
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/index.js
generated
vendored
19
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/index.js
generated
vendored
@ -1,19 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = {
|
||||
'instanceof': require('./instanceof'),
|
||||
range: require('./range'),
|
||||
regexp: require('./regexp'),
|
||||
'typeof': require('./typeof'),
|
||||
dynamicDefaults: require('./dynamicDefaults'),
|
||||
prohibited: require('./prohibited'),
|
||||
uniqueItemProperties: require('./uniqueItemProperties'),
|
||||
deepProperties: require('./deepProperties'),
|
||||
deepRequired: require('./deepRequired'),
|
||||
formatMinimum: require('./formatMinimum'),
|
||||
formatMaximum: require('./formatMaximum'),
|
||||
patternRequired: require('./patternRequired'),
|
||||
'switch': require('./switch'),
|
||||
select: require('./select'),
|
||||
transform: require('./transform')
|
||||
};
|
58
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/instanceof.js
generated
vendored
58
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/instanceof.js
generated
vendored
@ -1,58 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var CONSTRUCTORS = {
|
||||
Object: Object,
|
||||
Array: Array,
|
||||
Function: Function,
|
||||
Number: Number,
|
||||
String: String,
|
||||
Date: Date,
|
||||
RegExp: RegExp
|
||||
};
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
/* istanbul ignore else */
|
||||
if (typeof Buffer != 'undefined')
|
||||
CONSTRUCTORS.Buffer = Buffer;
|
||||
|
||||
/* istanbul ignore else */
|
||||
if (typeof Promise != 'undefined')
|
||||
CONSTRUCTORS.Promise = Promise;
|
||||
|
||||
defFunc.definition = {
|
||||
compile: function (schema) {
|
||||
if (typeof schema == 'string') {
|
||||
var Constructor = getConstructor(schema);
|
||||
return function (data) {
|
||||
return data instanceof Constructor;
|
||||
};
|
||||
}
|
||||
|
||||
var constructors = schema.map(getConstructor);
|
||||
return function (data) {
|
||||
for (var i=0; i<constructors.length; i++)
|
||||
if (data instanceof constructors[i]) return true;
|
||||
return false;
|
||||
};
|
||||
},
|
||||
CONSTRUCTORS: CONSTRUCTORS,
|
||||
metaSchema: {
|
||||
anyOf: [
|
||||
{ type: 'string' },
|
||||
{
|
||||
type: 'array',
|
||||
items: { type: 'string' }
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('instanceof', defFunc.definition);
|
||||
return ajv;
|
||||
|
||||
function getConstructor(c) {
|
||||
var Constructor = CONSTRUCTORS[c];
|
||||
if (Constructor) return Constructor;
|
||||
throw new Error('invalid "instanceof" keyword value ' + c);
|
||||
}
|
||||
};
|
21
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/patternRequired.js
generated
vendored
21
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/patternRequired.js
generated
vendored
@ -1,21 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
defFunc.definition = {
|
||||
type: 'object',
|
||||
inline: require('./dotjs/patternRequired'),
|
||||
statements: true,
|
||||
errors: 'full',
|
||||
metaSchema: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
format: 'regex'
|
||||
},
|
||||
uniqueItems: true
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('patternRequired', defFunc.definition);
|
||||
return ajv;
|
||||
};
|
25
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/prohibited.js
generated
vendored
25
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/prohibited.js
generated
vendored
@ -1,25 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
defFunc.definition = {
|
||||
type: 'object',
|
||||
macro: function (schema) {
|
||||
if (schema.length == 0) return {};
|
||||
if (schema.length == 1) return { not: { required: schema } };
|
||||
var schemas = schema.map(function (prop) {
|
||||
return { required: [prop] };
|
||||
});
|
||||
return { not: { anyOf: schemas } };
|
||||
},
|
||||
metaSchema: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string'
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('prohibited', defFunc.definition);
|
||||
return ajv;
|
||||
};
|
||||
|
36
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/range.js
generated
vendored
36
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/range.js
generated
vendored
@ -1,36 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
defFunc.definition = {
|
||||
type: 'number',
|
||||
macro: function (schema, parentSchema) {
|
||||
var min = schema[0]
|
||||
, max = schema[1]
|
||||
, exclusive = parentSchema.exclusiveRange;
|
||||
|
||||
validateRangeSchema(min, max, exclusive);
|
||||
|
||||
return exclusive === true
|
||||
? {exclusiveMinimum: min, exclusiveMaximum: max}
|
||||
: {minimum: min, maximum: max};
|
||||
},
|
||||
metaSchema: {
|
||||
type: 'array',
|
||||
minItems: 2,
|
||||
maxItems: 2,
|
||||
items: { type: 'number' }
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('range', defFunc.definition);
|
||||
ajv.addKeyword('exclusiveRange');
|
||||
return ajv;
|
||||
|
||||
function validateRangeSchema(min, max, exclusive) {
|
||||
if (exclusive !== undefined && typeof exclusive != 'boolean')
|
||||
throw new Error('Invalid schema for exclusiveRange keyword, should be boolean');
|
||||
|
||||
if (min > max || (exclusive && min == max))
|
||||
throw new Error('There are no numbers in range');
|
||||
}
|
||||
};
|
36
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/regexp.js
generated
vendored
36
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/regexp.js
generated
vendored
@ -1,36 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
defFunc.definition = {
|
||||
type: 'string',
|
||||
inline: function (it, keyword, schema) {
|
||||
return getRegExp() + '.test(data' + (it.dataLevel || '') + ')';
|
||||
|
||||
function getRegExp() {
|
||||
try {
|
||||
if (typeof schema == 'object')
|
||||
return new RegExp(schema.pattern, schema.flags);
|
||||
|
||||
var rx = schema.match(/^\/(.*)\/([gimy]*)$/);
|
||||
if (rx) return new RegExp(rx[1], rx[2]);
|
||||
throw new Error('cannot parse string into RegExp');
|
||||
} catch(e) {
|
||||
console.error('regular expression', schema, 'is invalid');
|
||||
throw e;
|
||||
}
|
||||
}
|
||||
},
|
||||
metaSchema: {
|
||||
type: ['string', 'object'],
|
||||
properties: {
|
||||
pattern: { type: 'string' },
|
||||
flags: { type: 'string' }
|
||||
},
|
||||
required: ['pattern'],
|
||||
additionalProperties: false
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('regexp', defFunc.definition);
|
||||
return ajv;
|
||||
};
|
79
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/select.js
generated
vendored
79
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/select.js
generated
vendored
@ -1,79 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('./_util');
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
if (!ajv._opts.$data) {
|
||||
console.warn('keyword select requires $data option');
|
||||
return ajv;
|
||||
}
|
||||
var metaSchemaRef = util.metaSchemaRef(ajv);
|
||||
var compiledCaseSchemas = [];
|
||||
|
||||
defFunc.definition = {
|
||||
validate: function v(schema, data, parentSchema) {
|
||||
if (parentSchema.selectCases === undefined)
|
||||
throw new Error('keyword "selectCases" is absent');
|
||||
var compiled = getCompiledSchemas(parentSchema, false);
|
||||
var validate = compiled.cases[schema];
|
||||
if (validate === undefined) validate = compiled.default;
|
||||
if (typeof validate == 'boolean') return validate;
|
||||
var valid = validate(data);
|
||||
if (!valid) v.errors = validate.errors;
|
||||
return valid;
|
||||
},
|
||||
$data: true,
|
||||
metaSchema: { type: ['string', 'number', 'boolean', 'null'] }
|
||||
};
|
||||
|
||||
ajv.addKeyword('select', defFunc.definition);
|
||||
ajv.addKeyword('selectCases', {
|
||||
compile: function (schemas, parentSchema) {
|
||||
var compiled = getCompiledSchemas(parentSchema);
|
||||
for (var value in schemas)
|
||||
compiled.cases[value] = compileOrBoolean(schemas[value]);
|
||||
return function() { return true; };
|
||||
},
|
||||
valid: true,
|
||||
metaSchema: {
|
||||
type: 'object',
|
||||
additionalProperties: metaSchemaRef
|
||||
}
|
||||
});
|
||||
ajv.addKeyword('selectDefault', {
|
||||
compile: function (schema, parentSchema) {
|
||||
var compiled = getCompiledSchemas(parentSchema);
|
||||
compiled.default = compileOrBoolean(schema);
|
||||
return function() { return true; };
|
||||
},
|
||||
valid: true,
|
||||
metaSchema: metaSchemaRef
|
||||
});
|
||||
return ajv;
|
||||
|
||||
|
||||
function getCompiledSchemas(parentSchema, create) {
|
||||
var compiled;
|
||||
compiledCaseSchemas.some(function (c) {
|
||||
if (c.parentSchema === parentSchema) {
|
||||
compiled = c;
|
||||
return true;
|
||||
}
|
||||
});
|
||||
if (!compiled && create !== false) {
|
||||
compiled = {
|
||||
parentSchema: parentSchema,
|
||||
cases: {},
|
||||
default: true
|
||||
};
|
||||
compiledCaseSchemas.push(compiled);
|
||||
}
|
||||
return compiled;
|
||||
}
|
||||
|
||||
function compileOrBoolean(schema) {
|
||||
return typeof schema == 'boolean'
|
||||
? schema
|
||||
: ajv.compile(schema);
|
||||
}
|
||||
};
|
38
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/switch.js
generated
vendored
38
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/switch.js
generated
vendored
@ -1,38 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var util = require('./_util');
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
if (ajv.RULES.keywords.switch && ajv.RULES.keywords.if) return;
|
||||
|
||||
var metaSchemaRef = util.metaSchemaRef(ajv);
|
||||
|
||||
defFunc.definition = {
|
||||
inline: require('./dotjs/switch'),
|
||||
statements: true,
|
||||
errors: 'full',
|
||||
metaSchema: {
|
||||
type: 'array',
|
||||
items: {
|
||||
required: [ 'then' ],
|
||||
properties: {
|
||||
'if': metaSchemaRef,
|
||||
'then': {
|
||||
anyOf: [
|
||||
{ type: 'boolean' },
|
||||
metaSchemaRef
|
||||
]
|
||||
},
|
||||
'continue': { type: 'boolean' }
|
||||
},
|
||||
additionalProperties: false,
|
||||
dependencies: {
|
||||
'continue': [ 'if' ]
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('switch', defFunc.definition);
|
||||
return ajv;
|
||||
};
|
79
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/transform.js
generated
vendored
79
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/transform.js
generated
vendored
@ -1,79 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function defFunc (ajv) {
|
||||
defFunc.definition = {
|
||||
type: 'string',
|
||||
errors: false,
|
||||
modifying: true,
|
||||
valid: true,
|
||||
compile: function (schema, parentSchema) {
|
||||
|
||||
// build hash table to enum values
|
||||
var hashtable = {};
|
||||
|
||||
if (schema.indexOf('toEnumCase') !== -1) {
|
||||
// requires `enum` in schema
|
||||
if (!parentSchema.enum)
|
||||
throw new Error('Missing enum. To use `transform:["toEnumCase"]`, `enum:[...]` is required.');
|
||||
for (var i = parentSchema.enum.length; i--; i) {
|
||||
var v = parentSchema.enum[i];
|
||||
if (typeof v !== 'string') continue;
|
||||
var k = makeHashTableKey(v);
|
||||
// requires all `enum` values have unique keys
|
||||
if (hashtable[k])
|
||||
throw new Error('Invalid enum uniqueness. To use `transform:["toEnumCase"]`, all values must be unique when case insensitive.');
|
||||
hashtable[k] = v;
|
||||
}
|
||||
}
|
||||
|
||||
var transform = {
|
||||
trimLeft: function (value) {
|
||||
return value.replace(/^[\s]+/, '');
|
||||
},
|
||||
trimRight: function (value) {
|
||||
return value.replace(/[\s]+$/, '');
|
||||
},
|
||||
trim: function (value) {
|
||||
return value.trim();
|
||||
},
|
||||
toLowerCase: function (value) {
|
||||
return value.toLowerCase();
|
||||
},
|
||||
toUpperCase: function (value) {
|
||||
return value.toUpperCase();
|
||||
},
|
||||
toEnumCase: function (value) {
|
||||
return hashtable[makeHashTableKey(value)] || value;
|
||||
}
|
||||
};
|
||||
|
||||
return function (value, objectKey, object, key) {
|
||||
// skip if value only
|
||||
if (!object) return;
|
||||
|
||||
// apply transform in order provided
|
||||
for (var j = 0, l = schema.length; j < l; j++) {
|
||||
if (typeof object[key] !== 'string') continue;
|
||||
object[key] = transform[schema[j]](object[key]);
|
||||
}
|
||||
};
|
||||
},
|
||||
metaSchema: {
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
enum: [
|
||||
'trimLeft', 'trimRight', 'trim',
|
||||
'toLowerCase', 'toUpperCase', 'toEnumCase'
|
||||
]
|
||||
}
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('transform', defFunc.definition);
|
||||
return ajv;
|
||||
|
||||
function makeHashTableKey (value) {
|
||||
return value.toLowerCase();
|
||||
}
|
||||
};
|
32
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/typeof.js
generated
vendored
32
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/typeof.js
generated
vendored
@ -1,32 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
var KNOWN_TYPES = ['undefined', 'string', 'number', 'object', 'function', 'boolean', 'symbol'];
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
defFunc.definition = {
|
||||
inline: function (it, keyword, schema) {
|
||||
var data = 'data' + (it.dataLevel || '');
|
||||
if (typeof schema == 'string') return 'typeof ' + data + ' == "' + schema + '"';
|
||||
schema = 'validate.schema' + it.schemaPath + '.' + keyword;
|
||||
return schema + '.indexOf(typeof ' + data + ') >= 0';
|
||||
},
|
||||
metaSchema: {
|
||||
anyOf: [
|
||||
{
|
||||
type: 'string',
|
||||
enum: KNOWN_TYPES
|
||||
},
|
||||
{
|
||||
type: 'array',
|
||||
items: {
|
||||
type: 'string',
|
||||
enum: KNOWN_TYPES
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('typeof', defFunc.definition);
|
||||
return ajv;
|
||||
};
|
32
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/uniqueItemProperties.js
generated
vendored
32
tools/node_modules/eslint/node_modules/ajv-keywords/keywords/uniqueItemProperties.js
generated
vendored
@ -1,32 +0,0 @@
|
||||
'use strict';
|
||||
|
||||
module.exports = function defFunc(ajv) {
|
||||
defFunc.definition = {
|
||||
type: 'array',
|
||||
compile: function(keys, parentSchema, it) {
|
||||
var equal = it.util.equal;
|
||||
return function(data) {
|
||||
if (data.length > 1) {
|
||||
for (var k=0; k < keys.length; k++) {
|
||||
var key = keys[k];
|
||||
for (var i = data.length; i--;) {
|
||||
if (typeof data[i] != 'object') continue;
|
||||
for (var j = i; j--;) {
|
||||
if (typeof data[j] == 'object' && equal(data[i][key], data[j][key]))
|
||||
return false;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
return true;
|
||||
};
|
||||
},
|
||||
metaSchema: {
|
||||
type: 'array',
|
||||
items: {type: 'string'}
|
||||
}
|
||||
};
|
||||
|
||||
ajv.addKeyword('uniqueItemProperties', defFunc.definition);
|
||||
return ajv;
|
||||
};
|
55
tools/node_modules/eslint/node_modules/ajv-keywords/package.json
generated
vendored
55
tools/node_modules/eslint/node_modules/ajv-keywords/package.json
generated
vendored
@ -1,55 +0,0 @@
|
||||
{
|
||||
"author": {
|
||||
"name": "Evgeny Poberezkin"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/epoberezkin/ajv-keywords/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Custom JSON-Schema keywords for Ajv validator",
|
||||
"devDependencies": {
|
||||
"ajv": "^6.0.0",
|
||||
"ajv-pack": "^0.3.0",
|
||||
"chai": "^4.0.2",
|
||||
"coveralls": "^3.0.0",
|
||||
"dot": "^1.1.1",
|
||||
"eslint": "^4.9.0",
|
||||
"glob": "^7.1.1",
|
||||
"istanbul": "^0.4.3",
|
||||
"js-beautify": "^1.7.4",
|
||||
"json-schema-test": "^2.0.0",
|
||||
"mocha": "^5.0.0",
|
||||
"pre-commit": "^1.1.3",
|
||||
"uuid": "^3.0.1"
|
||||
},
|
||||
"files": [
|
||||
"index.js",
|
||||
"keywords"
|
||||
],
|
||||
"homepage": "https://github.com/epoberezkin/ajv-keywords#readme",
|
||||
"keywords": [
|
||||
"JSON-Schema",
|
||||
"ajv",
|
||||
"keywords"
|
||||
],
|
||||
"license": "MIT",
|
||||
"main": "index.js",
|
||||
"name": "ajv-keywords",
|
||||
"peerDependencies": {
|
||||
"ajv": "^6.0.0"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/epoberezkin/ajv-keywords.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "node node_modules/ajv/scripts/compile-dots.js node_modules/ajv/lib keywords",
|
||||
"eslint": "eslint index.js keywords/*.js",
|
||||
"prepublish": "npm run build",
|
||||
"test": "npm run build && npm run eslint && npm run test-cov",
|
||||
"test-cov": "istanbul cover -x 'spec/**' node_modules/mocha/bin/_mocha -- spec/*.spec.js -R spec",
|
||||
"test-spec": "mocha spec/*.spec.js -R spec"
|
||||
},
|
||||
"version": "3.2.0"
|
||||
}
|
22
tools/node_modules/eslint/node_modules/color-name/README.md
generated
vendored
22
tools/node_modules/eslint/node_modules/color-name/README.md
generated
vendored
@ -1,11 +1,11 @@
|
||||
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
|
||||
|
||||
[](https://nodei.co/npm/color-name/)
|
||||
|
||||
|
||||
```js
|
||||
var colors = require('color-name');
|
||||
colors.red //[255,0,0]
|
||||
```
|
||||
|
||||
<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a>
|
||||
A JSON with color names and its values. Based on http://dev.w3.org/csswg/css-color/#named-colors.
|
||||
|
||||
[](https://nodei.co/npm/color-name/)
|
||||
|
||||
|
||||
```js
|
||||
var colors = require('color-name');
|
||||
colors.red //[255,0,0]
|
||||
```
|
||||
|
||||
<a href="LICENSE"><img src="https://upload.wikimedia.org/wikipedia/commons/0/0c/MIT_logo.svg" width="120"/></a>
|
||||
|
42
tools/node_modules/eslint/node_modules/color-name/index.js
generated
vendored
42
tools/node_modules/eslint/node_modules/color-name/index.js
generated
vendored
@ -1,14 +1,14 @@
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
"aliceblue": [240, 248, 255],
|
||||
"antiquewhite": [250, 235, 215],
|
||||
"aqua": [0, 255, 255],
|
||||
"aquamarine": [127, 255, 212],
|
||||
"azure": [240, 255, 255],
|
||||
"beige": [245, 245, 220],
|
||||
"bisque": [255, 228, 196],
|
||||
"black": [0, 0, 0],
|
||||
'use strict'
|
||||
|
||||
module.exports = {
|
||||
"aliceblue": [240, 248, 255],
|
||||
"antiquewhite": [250, 235, 215],
|
||||
"aqua": [0, 255, 255],
|
||||
"aquamarine": [127, 255, 212],
|
||||
"azure": [240, 255, 255],
|
||||
"beige": [245, 245, 220],
|
||||
"bisque": [255, 228, 196],
|
||||
"black": [0, 0, 0],
|
||||
"blanchedalmond": [255, 235, 205],
|
||||
"blue": [0, 0, 255],
|
||||
"blueviolet": [138, 43, 226],
|
||||
@ -140,13 +140,13 @@ module.exports = {
|
||||
"steelblue": [70, 130, 180],
|
||||
"tan": [210, 180, 140],
|
||||
"teal": [0, 128, 128],
|
||||
"thistle": [216, 191, 216],
|
||||
"tomato": [255, 99, 71],
|
||||
"turquoise": [64, 224, 208],
|
||||
"violet": [238, 130, 238],
|
||||
"wheat": [245, 222, 179],
|
||||
"white": [255, 255, 255],
|
||||
"whitesmoke": [245, 245, 245],
|
||||
"yellow": [255, 255, 0],
|
||||
"yellowgreen": [154, 205, 50]
|
||||
};
|
||||
"thistle": [216, 191, 216],
|
||||
"tomato": [255, 99, 71],
|
||||
"turquoise": [64, 224, 208],
|
||||
"violet": [238, 130, 238],
|
||||
"wheat": [245, 222, 179],
|
||||
"white": [255, 255, 255],
|
||||
"whitesmoke": [245, 245, 245],
|
||||
"yellow": [255, 255, 0],
|
||||
"yellowgreen": [154, 205, 50]
|
||||
};
|
||||
|
30
tools/node_modules/eslint/node_modules/debug/README.md
generated
vendored
30
tools/node_modules/eslint/node_modules/debug/README.md
generated
vendored
@ -269,7 +269,7 @@ log('still goes to stdout, but via console.info now');
|
||||
```
|
||||
|
||||
## Extend
|
||||
You can simply extend debugger
|
||||
You can simply extend debugger
|
||||
```js
|
||||
const log = require('debug')('auth');
|
||||
|
||||
@ -299,24 +299,42 @@ console.log(3, debug.enabled('test'));
|
||||
|
||||
```
|
||||
|
||||
print :
|
||||
print :
|
||||
```
|
||||
1 false
|
||||
2 true
|
||||
3 false
|
||||
```
|
||||
|
||||
Usage :
|
||||
`enable(namespaces)`
|
||||
Usage :
|
||||
`enable(namespaces)`
|
||||
`namespaces` can include modes separated by a colon and wildcards.
|
||||
|
||||
Note that calling `enable()` completely overrides previously set DEBUG variable :
|
||||
|
||||
Note that calling `enable()` completely overrides previously set DEBUG variable :
|
||||
|
||||
```
|
||||
$ DEBUG=foo node -e 'var dbg = require("debug"); dbg.enable("bar"); console.log(dbg.enabled("foo"))'
|
||||
=> false
|
||||
```
|
||||
|
||||
`disable()`
|
||||
|
||||
Will disable all namespaces. The functions returns the namespaces currently
|
||||
enabled (and skipped). This can be useful if you want to disable debugging
|
||||
temporarily without knowing what was enabled to begin with.
|
||||
|
||||
For example:
|
||||
|
||||
```js
|
||||
let debug = require('debug');
|
||||
debug.enable('foo:*,-foo:bar');
|
||||
let namespaces = debug.disable();
|
||||
debug.enable(namespaces);
|
||||
```
|
||||
|
||||
Note: There is no guarantee that the string will be identical to the initial
|
||||
enable string, but semantically they will be identical.
|
||||
|
||||
## Checking whether a debug target is enabled
|
||||
|
||||
After you've created a debug instance, you can determine whether or not it is
|
||||
|
1
tools/node_modules/eslint/node_modules/debug/dist/debug.js
generated
vendored
1
tools/node_modules/eslint/node_modules/debug/dist/debug.js
generated
vendored
@ -883,3 +883,4 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
|
||||
}]
|
||||
}, {}, [4])(4);
|
||||
});
|
||||
|
||||
|
15
tools/node_modules/eslint/node_modules/debug/package.json
generated
vendored
15
tools/node_modules/eslint/node_modules/debug/package.json
generated
vendored
@ -61,6 +61,19 @@
|
||||
"type": "git",
|
||||
"url": "git://github.com/visionmedia/debug.git"
|
||||
},
|
||||
"scripts": {
|
||||
"build": "npm run build:debug && npm run build:test",
|
||||
"build:debug": "babel -o dist/debug.js dist/debug.es6.js > dist/debug.js",
|
||||
"build:test": "babel -d dist test.js",
|
||||
"clean": "rimraf dist coverage",
|
||||
"lint": "xo",
|
||||
"posttest:node": "cat ./coverage/lcov.info | coveralls",
|
||||
"prebuild:debug": "mkdir -p dist && browserify --standalone debug -o dist/debug.es6.js .",
|
||||
"pretest:browser": "npm run build",
|
||||
"test": "npm run test:node && npm run test:browser",
|
||||
"test:browser": "karma start --single-run",
|
||||
"test:node": "istanbul cover _mocha -- test.js"
|
||||
},
|
||||
"unpkg": "./dist/debug.js",
|
||||
"version": "4.0.1"
|
||||
"version": "4.1.0"
|
||||
}
|
19
tools/node_modules/eslint/node_modules/debug/src/common.js
generated
vendored
19
tools/node_modules/eslint/node_modules/debug/src/common.js
generated
vendored
@ -187,10 +187,16 @@ function setup(env) {
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @return {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
function disable() {
|
||||
const namespaces = [
|
||||
...createDebug.names.map(toNamespace),
|
||||
...createDebug.skips.map(toNamespace).map(namespace => '-' + namespace)
|
||||
].join(',');
|
||||
createDebug.enable('');
|
||||
return namespaces;
|
||||
}
|
||||
|
||||
/**
|
||||
@ -223,6 +229,19 @@ function setup(env) {
|
||||
return false;
|
||||
}
|
||||
|
||||
/**
|
||||
* Convert regexp to namespace
|
||||
*
|
||||
* @param {RegExp} regxep
|
||||
* @return {String} namespace
|
||||
* @api private
|
||||
*/
|
||||
function toNamespace(regexp) {
|
||||
return regexp.toString()
|
||||
.substring(2, regexp.toString().length - 2)
|
||||
.replace(/\.\*\?$/, '*');
|
||||
}
|
||||
|
||||
/**
|
||||
* Coerce `val`.
|
||||
*
|
||||
|
2
tools/node_modules/eslint/node_modules/external-editor/README.md
generated
vendored
2
tools/node_modules/eslint/node_modules/external-editor/README.md
generated
vendored
@ -101,7 +101,7 @@ A full featured example
|
||||
- `text` (string) *readonly* The text in the temporary file.
|
||||
- `editor.bin` (string) The editor determined from the environment.
|
||||
- `editor.args` (array) Default arguments for the bin
|
||||
- `tempFile` (string) Path to temporary file. Can be changed, but be careful as the temporary file probably already
|
||||
- `tempFile` (string) Path to temporary file. Can be changed, but be careful as the temporary file probably already
|
||||
exists and would need be removed manually.
|
||||
- `lastExitStatus` (number) The last exit code emitted from the editor.
|
||||
|
||||
|
4
tools/node_modules/eslint/node_modules/globals/globals.json
generated
vendored
4
tools/node_modules/eslint/node_modules/globals/globals.json
generated
vendored
@ -996,6 +996,7 @@
|
||||
"URLSearchParams": false,
|
||||
"WebSocket": false,
|
||||
"Worker": false,
|
||||
"WorkerGlobalScope": false,
|
||||
"XMLHttpRequest": false
|
||||
},
|
||||
"node": {
|
||||
@ -1191,7 +1192,8 @@
|
||||
"jQuery": false
|
||||
},
|
||||
"yui": {
|
||||
"Y": false,
|
||||
"YAHOO": false,
|
||||
"YAHOO_config": false,
|
||||
"YUI": false,
|
||||
"YUI_config": false
|
||||
},
|
||||
|
2
tools/node_modules/eslint/node_modules/globals/package.json
generated
vendored
2
tools/node_modules/eslint/node_modules/globals/package.json
generated
vendored
@ -41,7 +41,7 @@
|
||||
"scripts": {
|
||||
"test": "xo && ava"
|
||||
},
|
||||
"version": "11.7.0",
|
||||
"version": "11.8.0",
|
||||
"xo": {
|
||||
"ignores": [
|
||||
"get-browser-globals.js"
|
||||
|
397
tools/node_modules/eslint/node_modules/regexpp/index.d.ts
generated
vendored
397
tools/node_modules/eslint/node_modules/regexpp/index.d.ts
generated
vendored
@ -1,149 +1,149 @@
|
||||
// Generated by dts-bundle v0.7.3
|
||||
|
||||
declare module 'regexpp' {
|
||||
import * as AST from "regexpp/ast";
|
||||
import { RegExpParser } from "regexpp/parser";
|
||||
import { RegExpValidator } from "regexpp/validator";
|
||||
import { RegExpVisitor } from "regexpp/visitor";
|
||||
export { AST, RegExpParser, RegExpValidator };
|
||||
export function parseRegExpLiteral(source: string | RegExp, options?: RegExpParser.Options): AST.RegExpLiteral;
|
||||
export function validateRegExpLiteral(source: string, options?: RegExpValidator.Options): void;
|
||||
export function visitRegExpAST(node: AST.Node, handlers: RegExpVisitor.Handlers): void;
|
||||
}
|
||||
|
||||
declare module 'regexpp/ast' {
|
||||
export type Node = BranchNode | LeafNode;
|
||||
export type BranchNode = RegExpLiteral | Pattern | Alternative | Group | CapturingGroup | Quantifier | CharacterClass | LookaroundAssertion | CharacterClassRange;
|
||||
export type LeafNode = BoundaryAssertion | CharacterSet | Character | Backreference | Flags;
|
||||
export type Element = Assertion | Quantifier | QuantifiableElement;
|
||||
export type QuantifiableElement = Group | CapturingGroup | CharacterClass | CharacterSet | Character | Backreference | LookaheadAssertion;
|
||||
export type CharacterClassElement = EscapeCharacterSet | UnicodePropertyCharacterSet | Character | CharacterClassRange;
|
||||
export interface NodeBase {
|
||||
type: Node["type"];
|
||||
parent: Node["parent"];
|
||||
start: number;
|
||||
end: number;
|
||||
raw: string;
|
||||
}
|
||||
export interface RegExpLiteral extends NodeBase {
|
||||
type: "RegExpLiteral";
|
||||
parent: null;
|
||||
pattern: Pattern;
|
||||
flags: Flags;
|
||||
}
|
||||
export interface Pattern extends NodeBase {
|
||||
type: "Pattern";
|
||||
parent: RegExpLiteral | null;
|
||||
alternatives: Alternative[];
|
||||
}
|
||||
export interface Alternative extends NodeBase {
|
||||
type: "Alternative";
|
||||
parent: Pattern | Group | CapturingGroup | LookaroundAssertion;
|
||||
elements: Element[];
|
||||
}
|
||||
export interface Group extends NodeBase {
|
||||
type: "Group";
|
||||
parent: Alternative | Quantifier;
|
||||
alternatives: Alternative[];
|
||||
}
|
||||
export interface CapturingGroup extends NodeBase {
|
||||
type: "CapturingGroup";
|
||||
parent: Alternative | Quantifier;
|
||||
name: string | null;
|
||||
alternatives: Alternative[];
|
||||
references: Backreference[];
|
||||
}
|
||||
export type LookaroundAssertion = LookaheadAssertion | LookbehindAssertion;
|
||||
export interface LookaheadAssertion extends NodeBase {
|
||||
type: "Assertion";
|
||||
parent: Alternative | Quantifier;
|
||||
kind: "lookahead";
|
||||
negate: boolean;
|
||||
alternatives: Alternative[];
|
||||
}
|
||||
export interface LookbehindAssertion extends NodeBase {
|
||||
type: "Assertion";
|
||||
parent: Alternative;
|
||||
kind: "lookbehind";
|
||||
negate: boolean;
|
||||
alternatives: Alternative[];
|
||||
}
|
||||
export interface Quantifier extends NodeBase {
|
||||
type: "Quantifier";
|
||||
parent: Alternative;
|
||||
min: number;
|
||||
max: number;
|
||||
greedy: boolean;
|
||||
element: QuantifiableElement;
|
||||
}
|
||||
export interface CharacterClass extends NodeBase {
|
||||
type: "CharacterClass";
|
||||
parent: Alternative | Quantifier;
|
||||
negate: boolean;
|
||||
elements: CharacterClassElement[];
|
||||
}
|
||||
export interface CharacterClassRange extends NodeBase {
|
||||
type: "CharacterClassRange";
|
||||
parent: CharacterClass;
|
||||
min: Character;
|
||||
max: Character;
|
||||
}
|
||||
export type Assertion = BoundaryAssertion | LookaroundAssertion;
|
||||
export type BoundaryAssertion = EdgeAssertion | WordBoundaryAssertion;
|
||||
export interface EdgeAssertion extends NodeBase {
|
||||
type: "Assertion";
|
||||
parent: Alternative | Quantifier;
|
||||
kind: "start" | "end";
|
||||
}
|
||||
export interface WordBoundaryAssertion extends NodeBase {
|
||||
type: "Assertion";
|
||||
parent: Alternative | Quantifier;
|
||||
kind: "word";
|
||||
negate: boolean;
|
||||
}
|
||||
export type CharacterSet = AnyCharacterSet | EscapeCharacterSet | UnicodePropertyCharacterSet;
|
||||
export interface AnyCharacterSet extends NodeBase {
|
||||
type: "CharacterSet";
|
||||
parent: Alternative | Quantifier;
|
||||
kind: "any";
|
||||
}
|
||||
export interface EscapeCharacterSet extends NodeBase {
|
||||
type: "CharacterSet";
|
||||
parent: Alternative | Quantifier | CharacterClass;
|
||||
kind: "digit" | "space" | "word";
|
||||
negate: boolean;
|
||||
}
|
||||
export interface UnicodePropertyCharacterSet extends NodeBase {
|
||||
type: "CharacterSet";
|
||||
parent: Alternative | Quantifier | CharacterClass;
|
||||
kind: "property";
|
||||
key: string;
|
||||
value: string | null;
|
||||
negate: boolean;
|
||||
}
|
||||
export interface Character extends NodeBase {
|
||||
type: "Character";
|
||||
parent: Alternative | Quantifier | CharacterClass | CharacterClassRange;
|
||||
value: number;
|
||||
}
|
||||
export interface Backreference extends NodeBase {
|
||||
type: "Backreference";
|
||||
parent: Alternative | Quantifier;
|
||||
ref: number | string;
|
||||
resolved: CapturingGroup;
|
||||
}
|
||||
export interface Flags extends NodeBase {
|
||||
type: "Flags";
|
||||
parent: RegExpLiteral | null;
|
||||
dotAll: boolean;
|
||||
global: boolean;
|
||||
ignoreCase: boolean;
|
||||
multiline: boolean;
|
||||
sticky: boolean;
|
||||
unicode: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
// Generated by dts-bundle v0.7.3
|
||||
|
||||
declare module 'regexpp' {
|
||||
import * as AST from "regexpp/ast";
|
||||
import { RegExpParser } from "regexpp/parser";
|
||||
import { RegExpValidator } from "regexpp/validator";
|
||||
import { RegExpVisitor } from "regexpp/visitor";
|
||||
export { AST, RegExpParser, RegExpValidator };
|
||||
export function parseRegExpLiteral(source: string | RegExp, options?: RegExpParser.Options): AST.RegExpLiteral;
|
||||
export function validateRegExpLiteral(source: string, options?: RegExpValidator.Options): void;
|
||||
export function visitRegExpAST(node: AST.Node, handlers: RegExpVisitor.Handlers): void;
|
||||
}
|
||||
|
||||
declare module 'regexpp/ast' {
|
||||
export type Node = BranchNode | LeafNode;
|
||||
export type BranchNode = RegExpLiteral | Pattern | Alternative | Group | CapturingGroup | Quantifier | CharacterClass | LookaroundAssertion | CharacterClassRange;
|
||||
export type LeafNode = BoundaryAssertion | CharacterSet | Character | Backreference | Flags;
|
||||
export type Element = Assertion | Quantifier | QuantifiableElement;
|
||||
export type QuantifiableElement = Group | CapturingGroup | CharacterClass | CharacterSet | Character | Backreference | LookaheadAssertion;
|
||||
export type CharacterClassElement = EscapeCharacterSet | UnicodePropertyCharacterSet | Character | CharacterClassRange;
|
||||
export interface NodeBase {
|
||||
type: Node["type"];
|
||||
parent: Node["parent"];
|
||||
start: number;
|
||||
end: number;
|
||||
raw: string;
|
||||
}
|
||||
export interface RegExpLiteral extends NodeBase {
|
||||
type: "RegExpLiteral";
|
||||
parent: null;
|
||||
pattern: Pattern;
|
||||
flags: Flags;
|
||||
}
|
||||
export interface Pattern extends NodeBase {
|
||||
type: "Pattern";
|
||||
parent: RegExpLiteral | null;
|
||||
alternatives: Alternative[];
|
||||
}
|
||||
export interface Alternative extends NodeBase {
|
||||
type: "Alternative";
|
||||
parent: Pattern | Group | CapturingGroup | LookaroundAssertion;
|
||||
elements: Element[];
|
||||
}
|
||||
export interface Group extends NodeBase {
|
||||
type: "Group";
|
||||
parent: Alternative | Quantifier;
|
||||
alternatives: Alternative[];
|
||||
}
|
||||
export interface CapturingGroup extends NodeBase {
|
||||
type: "CapturingGroup";
|
||||
parent: Alternative | Quantifier;
|
||||
name: string | null;
|
||||
alternatives: Alternative[];
|
||||
references: Backreference[];
|
||||
}
|
||||
export type LookaroundAssertion = LookaheadAssertion | LookbehindAssertion;
|
||||
export interface LookaheadAssertion extends NodeBase {
|
||||
type: "Assertion";
|
||||
parent: Alternative | Quantifier;
|
||||
kind: "lookahead";
|
||||
negate: boolean;
|
||||
alternatives: Alternative[];
|
||||
}
|
||||
export interface LookbehindAssertion extends NodeBase {
|
||||
type: "Assertion";
|
||||
parent: Alternative;
|
||||
kind: "lookbehind";
|
||||
negate: boolean;
|
||||
alternatives: Alternative[];
|
||||
}
|
||||
export interface Quantifier extends NodeBase {
|
||||
type: "Quantifier";
|
||||
parent: Alternative;
|
||||
min: number;
|
||||
max: number;
|
||||
greedy: boolean;
|
||||
element: QuantifiableElement;
|
||||
}
|
||||
export interface CharacterClass extends NodeBase {
|
||||
type: "CharacterClass";
|
||||
parent: Alternative | Quantifier;
|
||||
negate: boolean;
|
||||
elements: CharacterClassElement[];
|
||||
}
|
||||
export interface CharacterClassRange extends NodeBase {
|
||||
type: "CharacterClassRange";
|
||||
parent: CharacterClass;
|
||||
min: Character;
|
||||
max: Character;
|
||||
}
|
||||
export type Assertion = BoundaryAssertion | LookaroundAssertion;
|
||||
export type BoundaryAssertion = EdgeAssertion | WordBoundaryAssertion;
|
||||
export interface EdgeAssertion extends NodeBase {
|
||||
type: "Assertion";
|
||||
parent: Alternative | Quantifier;
|
||||
kind: "start" | "end";
|
||||
}
|
||||
export interface WordBoundaryAssertion extends NodeBase {
|
||||
type: "Assertion";
|
||||
parent: Alternative | Quantifier;
|
||||
kind: "word";
|
||||
negate: boolean;
|
||||
}
|
||||
export type CharacterSet = AnyCharacterSet | EscapeCharacterSet | UnicodePropertyCharacterSet;
|
||||
export interface AnyCharacterSet extends NodeBase {
|
||||
type: "CharacterSet";
|
||||
parent: Alternative | Quantifier;
|
||||
kind: "any";
|
||||
}
|
||||
export interface EscapeCharacterSet extends NodeBase {
|
||||
type: "CharacterSet";
|
||||
parent: Alternative | Quantifier | CharacterClass;
|
||||
kind: "digit" | "space" | "word";
|
||||
negate: boolean;
|
||||
}
|
||||
export interface UnicodePropertyCharacterSet extends NodeBase {
|
||||
type: "CharacterSet";
|
||||
parent: Alternative | Quantifier | CharacterClass;
|
||||
kind: "property";
|
||||
key: string;
|
||||
value: string | null;
|
||||
negate: boolean;
|
||||
}
|
||||
export interface Character extends NodeBase {
|
||||
type: "Character";
|
||||
parent: Alternative | Quantifier | CharacterClass | CharacterClassRange;
|
||||
value: number;
|
||||
}
|
||||
export interface Backreference extends NodeBase {
|
||||
type: "Backreference";
|
||||
parent: Alternative | Quantifier;
|
||||
ref: number | string;
|
||||
resolved: CapturingGroup;
|
||||
}
|
||||
export interface Flags extends NodeBase {
|
||||
type: "Flags";
|
||||
parent: RegExpLiteral | null;
|
||||
dotAll: boolean;
|
||||
global: boolean;
|
||||
ignoreCase: boolean;
|
||||
multiline: boolean;
|
||||
sticky: boolean;
|
||||
unicode: boolean;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'regexpp/parser' {
|
||||
import { Flags, RegExpLiteral, Pattern } from "regexpp/ast";
|
||||
export namespace RegExpParser {
|
||||
@ -186,55 +186,56 @@ declare module 'regexpp/validator' {
|
||||
onAnyCharacterSet?(start: number, end: number, kind: "any"): void;
|
||||
onEscapeCharacterSet?(start: number, end: number, kind: "digit" | "space" | "word", negate: boolean): void;
|
||||
onUnicodePropertyCharacterSet?(start: number, end: number, kind: "property", key: string, value: string | null, negate: boolean): void;
|
||||
onCharacter?(start: number, end: number, value: number): void;
|
||||
onBackreference?(start: number, end: number, ref: number | string): void;
|
||||
onCharacterClassEnter?(start: number, negate: boolean): void;
|
||||
onCharacterClassLeave?(start: number, end: number, negate: boolean): void;
|
||||
onCharacterClassRange?(start: number, end: number, min: number, max: number): void;
|
||||
}
|
||||
}
|
||||
export class RegExpValidator {
|
||||
constructor(options?: RegExpValidator.Options);
|
||||
validateLiteral(source: string, start?: number, end?: number): void;
|
||||
validateFlags(source: string, start?: number, end?: number): void;
|
||||
validatePattern(source: string, start?: number, end?: number, uFlag?: boolean): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'regexpp/visitor' {
|
||||
import { Alternative, Assertion, Backreference, CapturingGroup, Character, CharacterClass, CharacterClassRange, CharacterSet, Flags, Group, Node, Pattern, Quantifier, RegExpLiteral } from "regexpp/ast";
|
||||
export class RegExpVisitor {
|
||||
constructor(handlers: RegExpVisitor.Handlers);
|
||||
visit(node: Node): void;
|
||||
}
|
||||
export namespace RegExpVisitor {
|
||||
interface Handlers {
|
||||
onAlternativeEnter?(node: Alternative): void;
|
||||
onAlternativeLeave?(node: Alternative): void;
|
||||
onAssertionEnter?(node: Assertion): void;
|
||||
onAssertionLeave?(node: Assertion): void;
|
||||
onBackreferenceEnter?(node: Backreference): void;
|
||||
onBackreferenceLeave?(node: Backreference): void;
|
||||
onCapturingGroupEnter?(node: CapturingGroup): void;
|
||||
onCapturingGroupLeave?(node: CapturingGroup): void;
|
||||
onCharacterEnter?(node: Character): void;
|
||||
onCharacterLeave?(node: Character): void;
|
||||
onCharacterClassEnter?(node: CharacterClass): void;
|
||||
onCharacterClassLeave?(node: CharacterClass): void;
|
||||
onCharacterClassRangeEnter?(node: CharacterClassRange): void;
|
||||
onCharacterClassRangeLeave?(node: CharacterClassRange): void;
|
||||
onCharacterSetEnter?(node: CharacterSet): void;
|
||||
onCharacterSetLeave?(node: CharacterSet): void;
|
||||
onFlagsEnter?(node: Flags): void;
|
||||
onFlagsLeave?(node: Flags): void;
|
||||
onGroupEnter?(node: Group): void;
|
||||
onGroupLeave?(node: Group): void;
|
||||
onPatternEnter?(node: Pattern): void;
|
||||
onPatternLeave?(node: Pattern): void;
|
||||
onQuantifierEnter?(node: Quantifier): void;
|
||||
onQuantifierLeave?(node: Quantifier): void;
|
||||
onRegExpLiteralEnter?(node: RegExpLiteral): void;
|
||||
onRegExpLiteralLeave?(node: RegExpLiteral): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
onCharacter?(start: number, end: number, value: number): void;
|
||||
onBackreference?(start: number, end: number, ref: number | string): void;
|
||||
onCharacterClassEnter?(start: number, negate: boolean): void;
|
||||
onCharacterClassLeave?(start: number, end: number, negate: boolean): void;
|
||||
onCharacterClassRange?(start: number, end: number, min: number, max: number): void;
|
||||
}
|
||||
}
|
||||
export class RegExpValidator {
|
||||
constructor(options?: RegExpValidator.Options);
|
||||
validateLiteral(source: string, start?: number, end?: number): void;
|
||||
validateFlags(source: string, start?: number, end?: number): void;
|
||||
validatePattern(source: string, start?: number, end?: number, uFlag?: boolean): void;
|
||||
}
|
||||
}
|
||||
|
||||
declare module 'regexpp/visitor' {
|
||||
import { Alternative, Assertion, Backreference, CapturingGroup, Character, CharacterClass, CharacterClassRange, CharacterSet, Flags, Group, Node, Pattern, Quantifier, RegExpLiteral } from "regexpp/ast";
|
||||
export class RegExpVisitor {
|
||||
constructor(handlers: RegExpVisitor.Handlers);
|
||||
visit(node: Node): void;
|
||||
}
|
||||
export namespace RegExpVisitor {
|
||||
interface Handlers {
|
||||
onAlternativeEnter?(node: Alternative): void;
|
||||
onAlternativeLeave?(node: Alternative): void;
|
||||
onAssertionEnter?(node: Assertion): void;
|
||||
onAssertionLeave?(node: Assertion): void;
|
||||
onBackreferenceEnter?(node: Backreference): void;
|
||||
onBackreferenceLeave?(node: Backreference): void;
|
||||
onCapturingGroupEnter?(node: CapturingGroup): void;
|
||||
onCapturingGroupLeave?(node: CapturingGroup): void;
|
||||
onCharacterEnter?(node: Character): void;
|
||||
onCharacterLeave?(node: Character): void;
|
||||
onCharacterClassEnter?(node: CharacterClass): void;
|
||||
onCharacterClassLeave?(node: CharacterClass): void;
|
||||
onCharacterClassRangeEnter?(node: CharacterClassRange): void;
|
||||
onCharacterClassRangeLeave?(node: CharacterClassRange): void;
|
||||
onCharacterSetEnter?(node: CharacterSet): void;
|
||||
onCharacterSetLeave?(node: CharacterSet): void;
|
||||
onFlagsEnter?(node: Flags): void;
|
||||
onFlagsLeave?(node: Flags): void;
|
||||
onGroupEnter?(node: Group): void;
|
||||
onGroupLeave?(node: Group): void;
|
||||
onPatternEnter?(node: Pattern): void;
|
||||
onPatternLeave?(node: Pattern): void;
|
||||
onQuantifierEnter?(node: Quantifier): void;
|
||||
onQuantifierLeave?(node: Quantifier): void;
|
||||
onRegExpLiteralEnter?(node: RegExpLiteral): void;
|
||||
onRegExpLiteralLeave?(node: RegExpLiteral): void;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
|
15
tools/node_modules/eslint/node_modules/regexpp/index.js
generated
vendored
15
tools/node_modules/eslint/node_modules/regexpp/index.js
generated
vendored
@ -5684,6 +5684,9 @@ class RegExpValidator {
|
||||
if (cp === RightParenthesis) {
|
||||
this.raise("Unmatched ')'");
|
||||
}
|
||||
if (cp === ReverseSolidus) {
|
||||
this.raise("\\ at end of pattern");
|
||||
}
|
||||
if (cp === RightSquareBracket || cp === RightCurlyBracket) {
|
||||
this.raise("Lone quantifier brackets");
|
||||
}
|
||||
@ -5920,12 +5923,23 @@ class RegExpValidator {
|
||||
eatExtendedAtom() {
|
||||
return (this.eatDot() ||
|
||||
this.eatReverseSolidusAtomEscape() ||
|
||||
this.eatReverseSolidusFollowedByC() ||
|
||||
this.eatCharacterClass() ||
|
||||
this.eatUncapturingGroup() ||
|
||||
this.eatCapturingGroup() ||
|
||||
this.eatInvalidBracedQuantifier() ||
|
||||
this.eatExtendedPatternCharacter());
|
||||
}
|
||||
eatReverseSolidusFollowedByC() {
|
||||
if (this.currentCodePoint === ReverseSolidus &&
|
||||
this.nextCodePoint === LatinSmallLetterC) {
|
||||
this._lastIntValue = this.currentCodePoint;
|
||||
this.advance();
|
||||
this.onCharacter(this.index - 1, this.index, ReverseSolidus);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
eatInvalidBracedQuantifier() {
|
||||
if (this.eatBracedQuantifier(true)) {
|
||||
this.raise("Nothing to repeat");
|
||||
@ -5956,6 +5970,7 @@ class RegExpValidator {
|
||||
if (cp !== -1 &&
|
||||
cp !== CircumflexAccent &&
|
||||
cp !== DollarSign &&
|
||||
cp !== ReverseSolidus &&
|
||||
cp !== FullStop &&
|
||||
cp !== Asterisk &&
|
||||
cp !== PlusSign &&
|
||||
|
2
tools/node_modules/eslint/node_modules/regexpp/index.js.map
generated
vendored
2
tools/node_modules/eslint/node_modules/regexpp/index.js.map
generated
vendored
File diff suppressed because one or more lines are too long
15
tools/node_modules/eslint/node_modules/regexpp/index.mjs
generated
vendored
15
tools/node_modules/eslint/node_modules/regexpp/index.mjs
generated
vendored
@ -5680,6 +5680,9 @@ class RegExpValidator {
|
||||
if (cp === RightParenthesis) {
|
||||
this.raise("Unmatched ')'");
|
||||
}
|
||||
if (cp === ReverseSolidus) {
|
||||
this.raise("\\ at end of pattern");
|
||||
}
|
||||
if (cp === RightSquareBracket || cp === RightCurlyBracket) {
|
||||
this.raise("Lone quantifier brackets");
|
||||
}
|
||||
@ -5916,12 +5919,23 @@ class RegExpValidator {
|
||||
eatExtendedAtom() {
|
||||
return (this.eatDot() ||
|
||||
this.eatReverseSolidusAtomEscape() ||
|
||||
this.eatReverseSolidusFollowedByC() ||
|
||||
this.eatCharacterClass() ||
|
||||
this.eatUncapturingGroup() ||
|
||||
this.eatCapturingGroup() ||
|
||||
this.eatInvalidBracedQuantifier() ||
|
||||
this.eatExtendedPatternCharacter());
|
||||
}
|
||||
eatReverseSolidusFollowedByC() {
|
||||
if (this.currentCodePoint === ReverseSolidus &&
|
||||
this.nextCodePoint === LatinSmallLetterC) {
|
||||
this._lastIntValue = this.currentCodePoint;
|
||||
this.advance();
|
||||
this.onCharacter(this.index - 1, this.index, ReverseSolidus);
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
}
|
||||
eatInvalidBracedQuantifier() {
|
||||
if (this.eatBracedQuantifier(true)) {
|
||||
this.raise("Nothing to repeat");
|
||||
@ -5952,6 +5966,7 @@ class RegExpValidator {
|
||||
if (cp !== -1 &&
|
||||
cp !== CircumflexAccent &&
|
||||
cp !== DollarSign &&
|
||||
cp !== ReverseSolidus &&
|
||||
cp !== FullStop &&
|
||||
cp !== Asterisk &&
|
||||
cp !== PlusSign &&
|
||||
|
2
tools/node_modules/eslint/node_modules/regexpp/index.mjs.map
generated
vendored
2
tools/node_modules/eslint/node_modules/regexpp/index.mjs.map
generated
vendored
File diff suppressed because one or more lines are too long
2
tools/node_modules/eslint/node_modules/regexpp/package.json
generated
vendored
2
tools/node_modules/eslint/node_modules/regexpp/package.json
generated
vendored
@ -80,5 +80,5 @@
|
||||
"version": "npm run -s build",
|
||||
"watch": "_mocha \"test/*.ts\" --require ts-node/register --reporter dot --timeout 10000 --watch-extensions .ts --watch --growl"
|
||||
},
|
||||
"version": "2.0.0"
|
||||
"version": "2.0.1"
|
||||
}
|
166
tools/node_modules/eslint/node_modules/rxjs/bundles/rxjs.umd.js
generated
vendored
166
tools/node_modules/eslint/node_modules/rxjs/bundles/rxjs.umd.js
generated
vendored
@ -201,7 +201,7 @@
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
|
||||
**/
|
||||
/**
|
||||
@ -407,7 +407,7 @@
|
||||
WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
|
||||
See the License for the specific language governing permissions and
|
||||
limitations under the License.
|
||||
|
||||
|
||||
|
||||
**/
|
||||
(function (global, factory) {
|
||||
@ -416,86 +416,86 @@
|
||||
(factory((global.rxjs = global.rxjs || {})));
|
||||
}(this, (function (exports) { 'use strict';
|
||||
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise */
|
||||
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
|
||||
function __extends(d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
var __assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function __values(o) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
||||
if (m) return m.call(o);
|
||||
return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function __read(o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
/*! *****************************************************************************
|
||||
Copyright (c) Microsoft Corporation. All rights reserved.
|
||||
Licensed under the Apache License, Version 2.0 (the "License"); you may not use
|
||||
this file except in compliance with the License. You may obtain a copy of the
|
||||
License at http://www.apache.org/licenses/LICENSE-2.0
|
||||
|
||||
THIS CODE IS PROVIDED ON AN *AS IS* BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY
|
||||
KIND, EITHER EXPRESS OR IMPLIED, INCLUDING WITHOUT LIMITATION ANY IMPLIED
|
||||
WARRANTIES OR CONDITIONS OF TITLE, FITNESS FOR A PARTICULAR PURPOSE,
|
||||
MERCHANTABLITY OR NON-INFRINGEMENT.
|
||||
|
||||
See the Apache Version 2.0 License for specific language governing permissions
|
||||
and limitations under the License.
|
||||
***************************************************************************** */
|
||||
/* global Reflect, Promise */
|
||||
|
||||
var extendStatics = Object.setPrototypeOf ||
|
||||
({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) ||
|
||||
function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; };
|
||||
|
||||
function __extends(d, b) {
|
||||
extendStatics(d, b);
|
||||
function __() { this.constructor = d; }
|
||||
d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __());
|
||||
}
|
||||
|
||||
var __assign = Object.assign || function __assign(t) {
|
||||
for (var s, i = 1, n = arguments.length; i < n; i++) {
|
||||
s = arguments[i];
|
||||
for (var p in s) if (Object.prototype.hasOwnProperty.call(s, p)) t[p] = s[p];
|
||||
}
|
||||
return t;
|
||||
};
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
|
||||
function __values(o) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator], i = 0;
|
||||
if (m) return m.call(o);
|
||||
return {
|
||||
next: function () {
|
||||
if (o && i >= o.length) o = void 0;
|
||||
return { value: o && o[i++], done: !o };
|
||||
}
|
||||
};
|
||||
}
|
||||
|
||||
function __read(o, n) {
|
||||
var m = typeof Symbol === "function" && o[Symbol.iterator];
|
||||
if (!m) return o;
|
||||
var i = m.call(o), r, ar = [], e;
|
||||
try {
|
||||
while ((n === void 0 || n-- > 0) && !(r = i.next()).done) ar.push(r.value);
|
||||
}
|
||||
catch (error) { e = { error: error }; }
|
||||
finally {
|
||||
try {
|
||||
if (r && !r.done && (m = i["return"])) m.call(i);
|
||||
}
|
||||
finally { if (e) throw e.error; }
|
||||
}
|
||||
return ar;
|
||||
}
|
||||
|
||||
|
||||
|
||||
function __await(v) {
|
||||
return this instanceof __await ? (this.v = v, this) : new __await(v);
|
||||
}
|
||||
|
||||
function isFunction(x) {
|
||||
@ -9217,3 +9217,5 @@ exports.config = config;
|
||||
Object.defineProperty(exports, '__esModule', { value: true });
|
||||
|
||||
})));
|
||||
|
||||
|
||||
|
1
tools/node_modules/eslint/node_modules/rxjs/bundles/rxjs.umd.min.js
generated
vendored
1
tools/node_modules/eslint/node_modules/rxjs/bundles/rxjs.umd.min.js
generated
vendored
@ -288,3 +288,4 @@ arguments.length?(g=c.initialState,a=c.condition,b=c.iterate,f=c.resultSelector|
|
||||
a&&(a=R);void 0===b&&(b=R);return Da(function(){return c()?a:b})};e.interval=function(c,a){void 0===c&&(c=0);void 0===a&&(a=C);if(!ca(c)||0>c)c=0;a&&"function"===typeof a.schedule||(a=C);return new r(function(b){b.add(a.schedule(ec,c,{subscriber:b,counter:0,period:c}));return b})};e.merge=fb;e.never=function(){return Gb};e.of=ya;e.onErrorResumeNext=Ea;e.pairs=function(c,a){return a?new r(function(b){var d=Object.keys(c),e=new w;e.add(a.schedule(fc,0,{keys:d,index:0,subscriber:b,subscription:e,obj:c}));
|
||||
return e}):new r(function(a){for(var b=Object.keys(c),d=0;d<b.length&&!a.closed;d++){var e=b[d];c.hasOwnProperty(e)&&a.next([e,c[e]])}a.complete()})};e.race=gb;e.range=function(c,a,b){void 0===c&&(c=0);void 0===a&&(a=0);return new r(function(d){var e=0,f=c;if(b)return b.schedule(hc,0,{index:e,count:a,start:c,subscriber:d});do{if(e++>=a){d.complete();break}d.next(f++);if(d.closed)break}while(1)})};e.throwError=za;e.timer=hb;e.using=function(c,a){return new r(function(b){var d;try{d=c()}catch(E){b.error(E);
|
||||
return}var e;try{e=a(d)}catch(E){b.error(E);return}var h=(e?N(e):R).subscribe(b);return function(){h.unsubscribe();d&&d.unsubscribe()}})};e.zip=ib;e.EMPTY=R;e.NEVER=Gb;e.config=H;Object.defineProperty(e,"__esModule",{value:!0})});
|
||||
|
||||
|
48
tools/node_modules/eslint/node_modules/rxjs/src/internal/util/TimeoutError.ts
generated
vendored
48
tools/node_modules/eslint/node_modules/rxjs/src/internal/util/TimeoutError.ts
generated
vendored
@ -1,24 +1,24 @@
|
||||
export interface TimeoutError extends Error {
|
||||
}
|
||||
|
||||
export interface TimeoutErrorCtor {
|
||||
new(): TimeoutError;
|
||||
}
|
||||
|
||||
function TimeoutErrorImpl(this: any) {
|
||||
Error.call(this);
|
||||
this.message = 'Timeout has occurred';
|
||||
this.name = 'TimeoutError';
|
||||
return this;
|
||||
}
|
||||
|
||||
TimeoutErrorImpl.prototype = Object.create(Error.prototype);
|
||||
|
||||
/**
|
||||
* An error thrown when duetime elapses.
|
||||
*
|
||||
* @see {@link timeout}
|
||||
*
|
||||
* @class TimeoutError
|
||||
*/
|
||||
export const TimeoutError: TimeoutErrorCtor = TimeoutErrorImpl as any;
|
||||
export interface TimeoutError extends Error {
|
||||
}
|
||||
|
||||
export interface TimeoutErrorCtor {
|
||||
new(): TimeoutError;
|
||||
}
|
||||
|
||||
function TimeoutErrorImpl(this: any) {
|
||||
Error.call(this);
|
||||
this.message = 'Timeout has occurred';
|
||||
this.name = 'TimeoutError';
|
||||
return this;
|
||||
}
|
||||
|
||||
TimeoutErrorImpl.prototype = Object.create(Error.prototype);
|
||||
|
||||
/**
|
||||
* An error thrown when duetime elapses.
|
||||
*
|
||||
* @see {@link timeout}
|
||||
*
|
||||
* @class TimeoutError
|
||||
*/
|
||||
export const TimeoutError: TimeoutErrorCtor = TimeoutErrorImpl as any;
|
||||
|
21
tools/node_modules/eslint/node_modules/semver/README.md
generated
vendored
21
tools/node_modules/eslint/node_modules/semver/README.md
generated
vendored
@ -29,8 +29,6 @@ As a command-line utility:
|
||||
```
|
||||
$ semver -h
|
||||
|
||||
SemVer 5.3.0
|
||||
|
||||
A JavaScript implementation of the http://semver.org/ specification
|
||||
Copyright Isaac Z. Schlueter
|
||||
|
||||
@ -54,6 +52,9 @@ Options:
|
||||
-l --loose
|
||||
Interpret versions and ranges loosely
|
||||
|
||||
-p --include-prerelease
|
||||
Always include prerelease versions in range matching
|
||||
|
||||
-c --coerce
|
||||
Coerce a string into SemVer if possible
|
||||
(does not imply --loose)
|
||||
@ -289,9 +290,19 @@ 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.
|
||||
All methods and classes take a final `options` object argument. All
|
||||
options in this object are `false` by default. The options supported
|
||||
are:
|
||||
|
||||
- `loose` Be more forgiving about not-quite-valid semver strings.
|
||||
(Any resulting output will always be 100% strict compliant, of
|
||||
course.) For backwards compatibility reasons, if the `options`
|
||||
argument is a boolean value instead of an object, it is interpreted
|
||||
to be the `loose` param.
|
||||
- `includePrerelease` Set to suppress the [default
|
||||
behavior](https://github.com/npm/node-semver#prerelease-tags) of
|
||||
excluding prerelease tagged versions from ranges unless they are
|
||||
explicitly opted into.
|
||||
|
||||
Strict-mode Comparators and Ranges will be strict about the SemVer
|
||||
strings that they parse.
|
||||
|
18
tools/node_modules/eslint/node_modules/semver/bin/semver
generated
vendored
18
tools/node_modules/eslint/node_modules/semver/bin/semver
generated
vendored
@ -12,10 +12,12 @@ var argv = process.argv.slice(2)
|
||||
, inc = null
|
||||
, version = require("../package.json").version
|
||||
, loose = false
|
||||
, includePrerelease = false
|
||||
, coerce = false
|
||||
, identifier = undefined
|
||||
, semver = require("../semver")
|
||||
, reverse = false
|
||||
, options = {}
|
||||
|
||||
main()
|
||||
|
||||
@ -35,6 +37,9 @@ function main () {
|
||||
case "-l": case "--loose":
|
||||
loose = true
|
||||
break
|
||||
case "-p": case "--include-prerelease":
|
||||
includePrerelease = true
|
||||
break
|
||||
case "-v": case "--version":
|
||||
versions.push(argv.shift())
|
||||
break
|
||||
@ -66,6 +71,8 @@ function main () {
|
||||
}
|
||||
}
|
||||
|
||||
var options = { loose: loose, includePrerelease: includePrerelease }
|
||||
|
||||
versions = versions.map(function (v) {
|
||||
return coerce ? (semver.coerce(v) || {version: v}).version : v
|
||||
}).filter(function (v) {
|
||||
@ -77,7 +84,7 @@ function main () {
|
||||
|
||||
for (var i = 0, l = range.length; i < l ; i ++) {
|
||||
versions = versions.filter(function (v) {
|
||||
return semver.satisfies(v, range[i], loose)
|
||||
return semver.satisfies(v, range[i], options)
|
||||
})
|
||||
if (!versions.length) return fail()
|
||||
}
|
||||
@ -94,11 +101,11 @@ function fail () { process.exit(1) }
|
||||
function success () {
|
||||
var compare = reverse ? "rcompare" : "compare"
|
||||
versions.sort(function (a, b) {
|
||||
return semver[compare](a, b, loose)
|
||||
return semver[compare](a, b, options)
|
||||
}).map(function (v) {
|
||||
return semver.clean(v, loose)
|
||||
return semver.clean(v, options)
|
||||
}).map(function (v) {
|
||||
return inc ? semver.inc(v, inc, loose, identifier) : v
|
||||
return inc ? semver.inc(v, inc, options, identifier) : v
|
||||
}).forEach(function (v,i,_) { console.log(v) })
|
||||
}
|
||||
|
||||
@ -128,6 +135,9 @@ function help () {
|
||||
,"-l --loose"
|
||||
," Interpret versions and ranges loosely"
|
||||
,""
|
||||
,"-p --include-prerelease"
|
||||
," Always include prerelease versions in range matching"
|
||||
,""
|
||||
,"-c --coerce"
|
||||
," Coerce a string into SemVer if possible"
|
||||
," (does not imply --loose)"
|
||||
|
2
tools/node_modules/eslint/node_modules/semver/package.json
generated
vendored
2
tools/node_modules/eslint/node_modules/semver/package.json
generated
vendored
@ -27,5 +27,5 @@
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --cov -J"
|
||||
},
|
||||
"version": "5.5.1"
|
||||
"version": "5.6.0"
|
||||
}
|
236
tools/node_modules/eslint/node_modules/semver/semver.js
generated
vendored
236
tools/node_modules/eslint/node_modules/semver/semver.js
generated
vendored
@ -245,7 +245,10 @@ for (var i = 0; i < R; i++) {
|
||||
}
|
||||
|
||||
exports.parse = parse;
|
||||
function parse(version, loose) {
|
||||
function parse(version, options) {
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
|
||||
if (version instanceof SemVer)
|
||||
return version;
|
||||
|
||||
@ -255,35 +258,37 @@ function parse(version, loose) {
|
||||
if (version.length > MAX_LENGTH)
|
||||
return null;
|
||||
|
||||
var r = loose ? re[LOOSE] : re[FULL];
|
||||
var r = options.loose ? re[LOOSE] : re[FULL];
|
||||
if (!r.test(version))
|
||||
return null;
|
||||
|
||||
try {
|
||||
return new SemVer(version, loose);
|
||||
return new SemVer(version, options);
|
||||
} catch (er) {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
exports.valid = valid;
|
||||
function valid(version, loose) {
|
||||
var v = parse(version, loose);
|
||||
function valid(version, options) {
|
||||
var v = parse(version, options);
|
||||
return v ? v.version : null;
|
||||
}
|
||||
|
||||
|
||||
exports.clean = clean;
|
||||
function clean(version, loose) {
|
||||
var s = parse(version.trim().replace(/^[=v]+/, ''), loose);
|
||||
function clean(version, options) {
|
||||
var s = parse(version.trim().replace(/^[=v]+/, ''), options);
|
||||
return s ? s.version : null;
|
||||
}
|
||||
|
||||
exports.SemVer = SemVer;
|
||||
|
||||
function SemVer(version, loose) {
|
||||
function SemVer(version, options) {
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
if (version instanceof SemVer) {
|
||||
if (version.loose === loose)
|
||||
if (version.loose === options.loose)
|
||||
return version;
|
||||
else
|
||||
version = version.version;
|
||||
@ -295,11 +300,13 @@ function SemVer(version, loose) {
|
||||
throw new TypeError('version is longer than ' + MAX_LENGTH + ' characters')
|
||||
|
||||
if (!(this instanceof SemVer))
|
||||
return new SemVer(version, loose);
|
||||
return new SemVer(version, options);
|
||||
|
||||
debug('SemVer', version, loose);
|
||||
this.loose = loose;
|
||||
var m = version.trim().match(loose ? re[LOOSE] : re[FULL]);
|
||||
debug('SemVer', version, options);
|
||||
this.options = options;
|
||||
this.loose = !!options.loose;
|
||||
|
||||
var m = version.trim().match(options.loose ? re[LOOSE] : re[FULL]);
|
||||
|
||||
if (!m)
|
||||
throw new TypeError('Invalid Version: ' + version);
|
||||
@ -349,16 +356,16 @@ SemVer.prototype.toString = function() {
|
||||
};
|
||||
|
||||
SemVer.prototype.compare = function(other) {
|
||||
debug('SemVer.compare', this.version, this.loose, other);
|
||||
debug('SemVer.compare', this.version, this.options, other);
|
||||
if (!(other instanceof SemVer))
|
||||
other = new SemVer(other, this.loose);
|
||||
other = new SemVer(other, this.options);
|
||||
|
||||
return this.compareMain(other) || this.comparePre(other);
|
||||
};
|
||||
|
||||
SemVer.prototype.compareMain = function(other) {
|
||||
if (!(other instanceof SemVer))
|
||||
other = new SemVer(other, this.loose);
|
||||
other = new SemVer(other, this.options);
|
||||
|
||||
return compareIdentifiers(this.major, other.major) ||
|
||||
compareIdentifiers(this.minor, other.minor) ||
|
||||
@ -367,7 +374,7 @@ SemVer.prototype.compareMain = function(other) {
|
||||
|
||||
SemVer.prototype.comparePre = function(other) {
|
||||
if (!(other instanceof SemVer))
|
||||
other = new SemVer(other, this.loose);
|
||||
other = new SemVer(other, this.options);
|
||||
|
||||
// NOT having a prerelease is > having one
|
||||
if (this.prerelease.length && !other.prerelease.length)
|
||||
@ -658,19 +665,23 @@ function cmp(a, op, b, loose) {
|
||||
}
|
||||
|
||||
exports.Comparator = Comparator;
|
||||
function Comparator(comp, loose) {
|
||||
function Comparator(comp, options) {
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
|
||||
if (comp instanceof Comparator) {
|
||||
if (comp.loose === loose)
|
||||
if (comp.loose === !!options.loose)
|
||||
return comp;
|
||||
else
|
||||
comp = comp.value;
|
||||
}
|
||||
|
||||
if (!(this instanceof Comparator))
|
||||
return new Comparator(comp, loose);
|
||||
return new Comparator(comp, options);
|
||||
|
||||
debug('comparator', comp, loose);
|
||||
this.loose = loose;
|
||||
debug('comparator', comp, options);
|
||||
this.options = options;
|
||||
this.loose = !!options.loose;
|
||||
this.parse(comp);
|
||||
|
||||
if (this.semver === ANY)
|
||||
@ -683,7 +694,7 @@ function Comparator(comp, loose) {
|
||||
|
||||
var ANY = {};
|
||||
Comparator.prototype.parse = function(comp) {
|
||||
var r = this.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
|
||||
var r = this.options.loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
|
||||
var m = comp.match(r);
|
||||
|
||||
if (!m)
|
||||
@ -697,7 +708,7 @@ Comparator.prototype.parse = function(comp) {
|
||||
if (!m[2])
|
||||
this.semver = ANY;
|
||||
else
|
||||
this.semver = new SemVer(m[2], this.loose);
|
||||
this.semver = new SemVer(m[2], this.options.loose);
|
||||
};
|
||||
|
||||
Comparator.prototype.toString = function() {
|
||||
@ -705,30 +716,33 @@ Comparator.prototype.toString = function() {
|
||||
};
|
||||
|
||||
Comparator.prototype.test = function(version) {
|
||||
debug('Comparator.test', version, this.loose);
|
||||
debug('Comparator.test', version, this.options.loose);
|
||||
|
||||
if (this.semver === ANY)
|
||||
return true;
|
||||
|
||||
if (typeof version === 'string')
|
||||
version = new SemVer(version, this.loose);
|
||||
version = new SemVer(version, this.options);
|
||||
|
||||
return cmp(version, this.operator, this.semver, this.loose);
|
||||
return cmp(version, this.operator, this.semver, this.options);
|
||||
};
|
||||
|
||||
Comparator.prototype.intersects = function(comp, loose) {
|
||||
Comparator.prototype.intersects = function(comp, options) {
|
||||
if (!(comp instanceof Comparator)) {
|
||||
throw new TypeError('a Comparator is required');
|
||||
}
|
||||
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
|
||||
var rangeTmp;
|
||||
|
||||
if (this.operator === '') {
|
||||
rangeTmp = new Range(comp.value, loose);
|
||||
return satisfies(this.value, rangeTmp, loose);
|
||||
rangeTmp = new Range(comp.value, options);
|
||||
return satisfies(this.value, rangeTmp, options);
|
||||
} else if (comp.operator === '') {
|
||||
rangeTmp = new Range(this.value, loose);
|
||||
return satisfies(comp.semver, rangeTmp, loose);
|
||||
rangeTmp = new Range(this.value, options);
|
||||
return satisfies(comp.semver, rangeTmp, options);
|
||||
}
|
||||
|
||||
var sameDirectionIncreasing =
|
||||
@ -742,11 +756,11 @@ Comparator.prototype.intersects = function(comp, loose) {
|
||||
(this.operator === '>=' || this.operator === '<=') &&
|
||||
(comp.operator === '>=' || comp.operator === '<=');
|
||||
var oppositeDirectionsLessThan =
|
||||
cmp(this.semver, '<', comp.semver, loose) &&
|
||||
cmp(this.semver, '<', comp.semver, options) &&
|
||||
((this.operator === '>=' || this.operator === '>') &&
|
||||
(comp.operator === '<=' || comp.operator === '<'));
|
||||
var oppositeDirectionsGreaterThan =
|
||||
cmp(this.semver, '>', comp.semver, loose) &&
|
||||
cmp(this.semver, '>', comp.semver, options) &&
|
||||
((this.operator === '<=' || this.operator === '<') &&
|
||||
(comp.operator === '>=' || comp.operator === '>'));
|
||||
|
||||
@ -757,23 +771,29 @@ Comparator.prototype.intersects = function(comp, loose) {
|
||||
|
||||
|
||||
exports.Range = Range;
|
||||
function Range(range, loose) {
|
||||
function Range(range, options) {
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
|
||||
if (range instanceof Range) {
|
||||
if (range.loose === loose) {
|
||||
if (range.loose === !!options.loose &&
|
||||
range.includePrerelease === !!options.includePrerelease) {
|
||||
return range;
|
||||
} else {
|
||||
return new Range(range.raw, loose);
|
||||
return new Range(range.raw, options);
|
||||
}
|
||||
}
|
||||
|
||||
if (range instanceof Comparator) {
|
||||
return new Range(range.value, loose);
|
||||
return new Range(range.value, options);
|
||||
}
|
||||
|
||||
if (!(this instanceof Range))
|
||||
return new Range(range, loose);
|
||||
return new Range(range, options);
|
||||
|
||||
this.loose = loose;
|
||||
this.options = options;
|
||||
this.loose = !!options.loose;
|
||||
this.includePrerelease = !!options.includePrerelease
|
||||
|
||||
// First, split based on boolean or ||
|
||||
this.raw = range;
|
||||
@ -803,9 +823,8 @@ Range.prototype.toString = function() {
|
||||
};
|
||||
|
||||
Range.prototype.parseRange = function(range) {
|
||||
var loose = this.loose;
|
||||
var loose = this.options.loose;
|
||||
range = range.trim();
|
||||
debug('range', range, loose);
|
||||
// `1.2.3 - 1.2.4` => `>=1.2.3 <=1.2.4`
|
||||
var hr = loose ? re[HYPHENRANGELOOSE] : re[HYPHENRANGE];
|
||||
range = range.replace(hr, hyphenReplace);
|
||||
@ -828,22 +847,22 @@ Range.prototype.parseRange = function(range) {
|
||||
|
||||
var compRe = loose ? re[COMPARATORLOOSE] : re[COMPARATOR];
|
||||
var set = range.split(' ').map(function(comp) {
|
||||
return parseComparator(comp, loose);
|
||||
}).join(' ').split(/\s+/);
|
||||
if (this.loose) {
|
||||
return parseComparator(comp, this.options);
|
||||
}, this).join(' ').split(/\s+/);
|
||||
if (this.options.loose) {
|
||||
// in loose mode, throw out any that are not valid comparators
|
||||
set = set.filter(function(comp) {
|
||||
return !!comp.match(compRe);
|
||||
});
|
||||
}
|
||||
set = set.map(function(comp) {
|
||||
return new Comparator(comp, loose);
|
||||
});
|
||||
return new Comparator(comp, this.options);
|
||||
}, this);
|
||||
|
||||
return set;
|
||||
};
|
||||
|
||||
Range.prototype.intersects = function(range, loose) {
|
||||
Range.prototype.intersects = function(range, options) {
|
||||
if (!(range instanceof Range)) {
|
||||
throw new TypeError('a Range is required');
|
||||
}
|
||||
@ -852,7 +871,7 @@ Range.prototype.intersects = function(range, loose) {
|
||||
return thisComparators.every(function(thisComparator) {
|
||||
return range.set.some(function(rangeComparators) {
|
||||
return rangeComparators.every(function(rangeComparator) {
|
||||
return thisComparator.intersects(rangeComparator, loose);
|
||||
return thisComparator.intersects(rangeComparator, options);
|
||||
});
|
||||
});
|
||||
});
|
||||
@ -861,8 +880,8 @@ Range.prototype.intersects = function(range, loose) {
|
||||
|
||||
// Mostly just for testing and legacy API reasons
|
||||
exports.toComparators = toComparators;
|
||||
function toComparators(range, loose) {
|
||||
return new Range(range, loose).set.map(function(comp) {
|
||||
function toComparators(range, options) {
|
||||
return new Range(range, options).set.map(function(comp) {
|
||||
return comp.map(function(c) {
|
||||
return c.value;
|
||||
}).join(' ').trim().split(' ');
|
||||
@ -872,15 +891,15 @@ function toComparators(range, loose) {
|
||||
// comprised of xranges, tildes, stars, and gtlt's at this point.
|
||||
// already replaced the hyphen ranges
|
||||
// turn into a set of JUST comparators.
|
||||
function parseComparator(comp, loose) {
|
||||
debug('comp', comp);
|
||||
comp = replaceCarets(comp, loose);
|
||||
function parseComparator(comp, options) {
|
||||
debug('comp', comp, options);
|
||||
comp = replaceCarets(comp, options);
|
||||
debug('caret', comp);
|
||||
comp = replaceTildes(comp, loose);
|
||||
comp = replaceTildes(comp, options);
|
||||
debug('tildes', comp);
|
||||
comp = replaceXRanges(comp, loose);
|
||||
comp = replaceXRanges(comp, options);
|
||||
debug('xrange', comp);
|
||||
comp = replaceStars(comp, loose);
|
||||
comp = replaceStars(comp, options);
|
||||
debug('stars', comp);
|
||||
return comp;
|
||||
}
|
||||
@ -895,14 +914,16 @@ function isX(id) {
|
||||
// ~1.2, ~1.2.x, ~>1.2, ~>1.2.x --> >=1.2.0 <1.3.0
|
||||
// ~1.2.3, ~>1.2.3 --> >=1.2.3 <1.3.0
|
||||
// ~1.2.0, ~>1.2.0 --> >=1.2.0 <1.3.0
|
||||
function replaceTildes(comp, loose) {
|
||||
function replaceTildes(comp, options) {
|
||||
return comp.trim().split(/\s+/).map(function(comp) {
|
||||
return replaceTilde(comp, loose);
|
||||
return replaceTilde(comp, options);
|
||||
}).join(' ');
|
||||
}
|
||||
|
||||
function replaceTilde(comp, loose) {
|
||||
var r = loose ? re[TILDELOOSE] : re[TILDE];
|
||||
function replaceTilde(comp, options) {
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
var r = options.loose ? re[TILDELOOSE] : re[TILDE];
|
||||
return comp.replace(r, function(_, M, m, p, pr) {
|
||||
debug('tilde', comp, _, M, m, p, pr);
|
||||
var ret;
|
||||
@ -936,15 +957,17 @@ function replaceTilde(comp, loose) {
|
||||
// ^1.2, ^1.2.x --> >=1.2.0 <2.0.0
|
||||
// ^1.2.3 --> >=1.2.3 <2.0.0
|
||||
// ^1.2.0 --> >=1.2.0 <2.0.0
|
||||
function replaceCarets(comp, loose) {
|
||||
function replaceCarets(comp, options) {
|
||||
return comp.trim().split(/\s+/).map(function(comp) {
|
||||
return replaceCaret(comp, loose);
|
||||
return replaceCaret(comp, options);
|
||||
}).join(' ');
|
||||
}
|
||||
|
||||
function replaceCaret(comp, loose) {
|
||||
debug('caret', comp, loose);
|
||||
var r = loose ? re[CARETLOOSE] : re[CARET];
|
||||
function replaceCaret(comp, options) {
|
||||
debug('caret', comp, options);
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
var r = options.loose ? re[CARETLOOSE] : re[CARET];
|
||||
return comp.replace(r, function(_, M, m, p, pr) {
|
||||
debug('caret', comp, _, M, m, p, pr);
|
||||
var ret;
|
||||
@ -991,16 +1014,18 @@ function replaceCaret(comp, loose) {
|
||||
});
|
||||
}
|
||||
|
||||
function replaceXRanges(comp, loose) {
|
||||
debug('replaceXRanges', comp, loose);
|
||||
function replaceXRanges(comp, options) {
|
||||
debug('replaceXRanges', comp, options);
|
||||
return comp.split(/\s+/).map(function(comp) {
|
||||
return replaceXRange(comp, loose);
|
||||
return replaceXRange(comp, options);
|
||||
}).join(' ');
|
||||
}
|
||||
|
||||
function replaceXRange(comp, loose) {
|
||||
function replaceXRange(comp, options) {
|
||||
comp = comp.trim();
|
||||
var r = loose ? re[XRANGELOOSE] : re[XRANGE];
|
||||
if (!options || typeof options !== 'object')
|
||||
options = { loose: !!options, includePrerelease: false }
|
||||
var r = options.loose ? re[XRANGELOOSE] : re[XRANGE];
|
||||
return comp.replace(r, function(ret, gtlt, M, m, p, pr) {
|
||||
debug('xRange', comp, ret, gtlt, M, m, p, pr);
|
||||
var xM = isX(M);
|
||||
@ -1064,8 +1089,8 @@ function replaceXRange(comp, loose) {
|
||||
|
||||
// Because * is AND-ed with everything else in the comparator,
|
||||
// and '' means "any version", just remove the *s entirely.
|
||||
function replaceStars(comp, loose) {
|
||||
debug('replaceStars', comp, loose);
|
||||
function replaceStars(comp, options) {
|
||||
debug('replaceStars', comp, options);
|
||||
// Looseness is ignored here. star is always as loose as it gets!
|
||||
return comp.trim().replace(re[STAR], '');
|
||||
}
|
||||
@ -1109,22 +1134,25 @@ Range.prototype.test = function(version) {
|
||||
return false;
|
||||
|
||||
if (typeof version === 'string')
|
||||
version = new SemVer(version, this.loose);
|
||||
version = new SemVer(version, this.options);
|
||||
|
||||
for (var i = 0; i < this.set.length; i++) {
|
||||
if (testSet(this.set[i], version))
|
||||
if (testSet(this.set[i], version, this.options))
|
||||
return true;
|
||||
}
|
||||
return false;
|
||||
};
|
||||
|
||||
function testSet(set, version) {
|
||||
function testSet(set, version, options) {
|
||||
for (var i = 0; i < set.length; i++) {
|
||||
if (!set[i].test(version))
|
||||
return false;
|
||||
}
|
||||
|
||||
if (version.prerelease.length) {
|
||||
if (!options)
|
||||
options = {}
|
||||
|
||||
if (version.prerelease.length && !options.includePrerelease) {
|
||||
// Find the set of versions that are allowed to have prereleases
|
||||
// For example, ^1.2.3-pr.1 desugars to >=1.2.3-pr.1 <2.0.0
|
||||
// That should allow `1.2.3-pr.2` to pass.
|
||||
@ -1152,9 +1180,9 @@ function testSet(set, version) {
|
||||
}
|
||||
|
||||
exports.satisfies = satisfies;
|
||||
function satisfies(version, range, loose) {
|
||||
function satisfies(version, range, options) {
|
||||
try {
|
||||
range = new Range(range, loose);
|
||||
range = new Range(range, options);
|
||||
} catch (er) {
|
||||
return false;
|
||||
}
|
||||
@ -1162,19 +1190,19 @@ function satisfies(version, range, loose) {
|
||||
}
|
||||
|
||||
exports.maxSatisfying = maxSatisfying;
|
||||
function maxSatisfying(versions, range, loose) {
|
||||
function maxSatisfying(versions, range, options) {
|
||||
var max = null;
|
||||
var maxSV = null;
|
||||
try {
|
||||
var rangeObj = new Range(range, loose);
|
||||
var rangeObj = new Range(range, options);
|
||||
} catch (er) {
|
||||
return null;
|
||||
}
|
||||
versions.forEach(function (v) {
|
||||
if (rangeObj.test(v)) { // satisfies(v, range, loose)
|
||||
if (rangeObj.test(v)) { // satisfies(v, range, options)
|
||||
if (!max || maxSV.compare(v) === -1) { // compare(max, v, true)
|
||||
max = v;
|
||||
maxSV = new SemVer(max, loose);
|
||||
maxSV = new SemVer(max, options);
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -1182,19 +1210,19 @@ function maxSatisfying(versions, range, loose) {
|
||||
}
|
||||
|
||||
exports.minSatisfying = minSatisfying;
|
||||
function minSatisfying(versions, range, loose) {
|
||||
function minSatisfying(versions, range, options) {
|
||||
var min = null;
|
||||
var minSV = null;
|
||||
try {
|
||||
var rangeObj = new Range(range, loose);
|
||||
var rangeObj = new Range(range, options);
|
||||
} catch (er) {
|
||||
return null;
|
||||
}
|
||||
versions.forEach(function (v) {
|
||||
if (rangeObj.test(v)) { // satisfies(v, range, loose)
|
||||
if (rangeObj.test(v)) { // satisfies(v, range, options)
|
||||
if (!min || minSV.compare(v) === 1) { // compare(min, v, true)
|
||||
min = v;
|
||||
minSV = new SemVer(min, loose);
|
||||
minSV = new SemVer(min, options);
|
||||
}
|
||||
}
|
||||
})
|
||||
@ -1202,11 +1230,11 @@ function minSatisfying(versions, range, loose) {
|
||||
}
|
||||
|
||||
exports.validRange = validRange;
|
||||
function validRange(range, loose) {
|
||||
function validRange(range, options) {
|
||||
try {
|
||||
// Return '*' instead of '' so that truthiness works.
|
||||
// This will throw if it's invalid anyway
|
||||
return new Range(range, loose).range || '*';
|
||||
return new Range(range, options).range || '*';
|
||||
} catch (er) {
|
||||
return null;
|
||||
}
|
||||
@ -1214,20 +1242,20 @@ function validRange(range, loose) {
|
||||
|
||||
// Determine if version is less than all the versions possible in the range
|
||||
exports.ltr = ltr;
|
||||
function ltr(version, range, loose) {
|
||||
return outside(version, range, '<', loose);
|
||||
function ltr(version, range, options) {
|
||||
return outside(version, range, '<', options);
|
||||
}
|
||||
|
||||
// Determine if version is greater than all the versions possible in the range.
|
||||
exports.gtr = gtr;
|
||||
function gtr(version, range, loose) {
|
||||
return outside(version, range, '>', loose);
|
||||
function gtr(version, range, options) {
|
||||
return outside(version, range, '>', options);
|
||||
}
|
||||
|
||||
exports.outside = outside;
|
||||
function outside(version, range, hilo, loose) {
|
||||
version = new SemVer(version, loose);
|
||||
range = new Range(range, loose);
|
||||
function outside(version, range, hilo, options) {
|
||||
version = new SemVer(version, options);
|
||||
range = new Range(range, options);
|
||||
|
||||
var gtfn, ltefn, ltfn, comp, ecomp;
|
||||
switch (hilo) {
|
||||
@ -1250,7 +1278,7 @@ function outside(version, range, hilo, loose) {
|
||||
}
|
||||
|
||||
// If it satisifes the range it is not outside
|
||||
if (satisfies(version, range, loose)) {
|
||||
if (satisfies(version, range, options)) {
|
||||
return false;
|
||||
}
|
||||
|
||||
@ -1269,9 +1297,9 @@ function outside(version, range, hilo, loose) {
|
||||
}
|
||||
high = high || comparator;
|
||||
low = low || comparator;
|
||||
if (gtfn(comparator.semver, high.semver, loose)) {
|
||||
if (gtfn(comparator.semver, high.semver, options)) {
|
||||
high = comparator;
|
||||
} else if (ltfn(comparator.semver, low.semver, loose)) {
|
||||
} else if (ltfn(comparator.semver, low.semver, options)) {
|
||||
low = comparator;
|
||||
}
|
||||
});
|
||||
@ -1295,15 +1323,15 @@ function outside(version, range, hilo, loose) {
|
||||
}
|
||||
|
||||
exports.prerelease = prerelease;
|
||||
function prerelease(version, loose) {
|
||||
var parsed = parse(version, loose);
|
||||
function prerelease(version, options) {
|
||||
var parsed = parse(version, options);
|
||||
return (parsed && parsed.prerelease.length) ? parsed.prerelease : null;
|
||||
}
|
||||
|
||||
exports.intersects = intersects;
|
||||
function intersects(r1, r2, loose) {
|
||||
r1 = new Range(r1, loose)
|
||||
r2 = new Range(r2, loose)
|
||||
function intersects(r1, r2, options) {
|
||||
r1 = new Range(r1, options)
|
||||
r2 = new Range(r2, options)
|
||||
return r1.intersects(r2)
|
||||
}
|
||||
|
||||
|
2
tools/node_modules/eslint/node_modules/table/LICENSE
generated
vendored
2
tools/node_modules/eslint/node_modules/table/LICENSE
generated
vendored
@ -1,4 +1,4 @@
|
||||
Copyright (c) 2016, Gajus Kuizinas (http://gajus.com/)
|
||||
Copyright (c) 2018, Gajus Kuizinas (http://gajus.com/)
|
||||
All rights reserved.
|
||||
|
||||
Redistribution and use in source and binary forms, with or without
|
||||
|
16
tools/node_modules/eslint/node_modules/table/README.md
generated
vendored
16
tools/node_modules/eslint/node_modules/table/README.md
generated
vendored
@ -1,9 +1,11 @@
|
||||
<a name="table"></a>
|
||||
# Table
|
||||
|
||||
[](https://travis-ci.org/gajus/table)
|
||||
[](https://www.npmjs.com/package/table)
|
||||
[](https://github.com/gajus/canonical)
|
||||
[](https://travis-ci.org/gajus/table)
|
||||
[](https://coveralls.io/github/gajus/table)
|
||||
[](https://www.npmjs.org/package/table)
|
||||
[](https://github.com/gajus/canonical)
|
||||
[](https://twitter.com/kuizinas)
|
||||
|
||||
* [Table](#table)
|
||||
* [Features](#table-features)
|
||||
@ -96,7 +98,7 @@ data = [
|
||||
* Used to dynamically tell table whether to draw a line separating rows or not.
|
||||
* The default behavior is to always return true.
|
||||
*
|
||||
* @typedef {function} drawJoin
|
||||
* @typedef {function} drawHorizontalLine
|
||||
* @param {number} index
|
||||
* @param {number} size
|
||||
* @return {boolean}
|
||||
@ -107,7 +109,7 @@ data = [
|
||||
* @property {table~border} border
|
||||
* @property {table~columns[]} columns Column specific configuration.
|
||||
* @property {table~columns} columnDefault Default values for all columns. Column specific settings overwrite the default values.
|
||||
* @property {table~drawJoin} drawHorizontalLine
|
||||
* @property {table~drawHorizontalLine} drawHorizontalLine
|
||||
*/
|
||||
|
||||
/**
|
||||
@ -296,7 +298,7 @@ data = [
|
||||
|
||||
options = {
|
||||
/**
|
||||
* @typedef {function} drawJoin
|
||||
* @typedef {function} drawHorizontalLine
|
||||
* @param {number} index
|
||||
* @param {number} size
|
||||
* @return {boolean}
|
||||
@ -309,6 +311,7 @@ options = {
|
||||
output = table(data, options);
|
||||
|
||||
console.log(output);
|
||||
|
||||
```
|
||||
|
||||
```
|
||||
@ -321,6 +324,7 @@ console.log(output);
|
||||
╟────┼────┼────╢
|
||||
║ 4A │ 4B │ 4C ║
|
||||
╚════╧════╧════╝
|
||||
|
||||
```
|
||||
|
||||
<a name="table-usage-padding-cell-content"></a>
|
||||
|
40
tools/node_modules/eslint/node_modules/table/dist/alignString.js
generated
vendored
40
tools/node_modules/eslint/node_modules/table/dist/alignString.js
generated
vendored
@ -1,58 +1,54 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _lodash = require('lodash');
|
||||
var _lodash = _interopRequireDefault(require("lodash"));
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _stringWidth = require('string-width');
|
||||
|
||||
var _stringWidth2 = _interopRequireDefault(_stringWidth);
|
||||
var _stringWidth = _interopRequireDefault(require("string-width"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
const alignments = ['left', 'right', 'center'];
|
||||
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
const alignLeft = (subject, width) => {
|
||||
return subject + ' '.repeat(width);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
const alignRight = (subject, width) => {
|
||||
return ' '.repeat(width) + subject;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
const alignCenter = (subject, width) => {
|
||||
let halfWidth;
|
||||
|
||||
halfWidth = width / 2;
|
||||
|
||||
if (halfWidth % 2 === 0) {
|
||||
return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth);
|
||||
} else {
|
||||
halfWidth = Math.floor(halfWidth);
|
||||
|
||||
return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth + 1);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Pads a string to the left and/or right to position the subject
|
||||
* text in a desired alignment within a container.
|
||||
@ -63,24 +59,24 @@ const alignCenter = (subject, width) => {
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
exports.default = (subject, containerWidth, alignment) => {
|
||||
if (!_lodash2.default.isString(subject)) {
|
||||
|
||||
const alignString = (subject, containerWidth, alignment) => {
|
||||
if (!_lodash.default.isString(subject)) {
|
||||
throw new TypeError('Subject parameter value must be a string.');
|
||||
}
|
||||
|
||||
if (!_lodash2.default.isNumber(containerWidth)) {
|
||||
if (!_lodash.default.isNumber(containerWidth)) {
|
||||
throw new TypeError('Container width parameter value must be a number.');
|
||||
}
|
||||
|
||||
const subjectWidth = (0, _stringWidth2.default)(subject);
|
||||
const subjectWidth = (0, _stringWidth.default)(subject);
|
||||
|
||||
if (subjectWidth > containerWidth) {
|
||||
// console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject);
|
||||
|
||||
throw new Error('Subject parameter value width cannot be greater than the container width.');
|
||||
}
|
||||
|
||||
if (!_lodash2.default.isString(alignment)) {
|
||||
if (!_lodash.default.isString(alignment)) {
|
||||
throw new TypeError('Alignment parameter value must be a string.');
|
||||
}
|
||||
|
||||
@ -103,4 +99,8 @@ exports.default = (subject, containerWidth, alignment) => {
|
||||
}
|
||||
|
||||
return alignCenter(subject, availableWidth);
|
||||
};
|
||||
};
|
||||
|
||||
var _default = alignString;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=alignString.js.map
|
96
tools/node_modules/eslint/node_modules/table/dist/alignString.js.flow
generated
vendored
Normal file
96
tools/node_modules/eslint/node_modules/table/dist/alignString.js.flow
generated
vendored
Normal file
@ -0,0 +1,96 @@
|
||||
import _ from 'lodash';
|
||||
import stringWidth from 'string-width';
|
||||
|
||||
const alignments = [
|
||||
'left',
|
||||
'right',
|
||||
'center'
|
||||
];
|
||||
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
const alignLeft = (subject, width) => {
|
||||
return subject + ' '.repeat(width);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
const alignRight = (subject, width) => {
|
||||
return ' '.repeat(width) + subject;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string} subject
|
||||
* @param {number} width
|
||||
* @returns {string}
|
||||
*/
|
||||
const alignCenter = (subject, width) => {
|
||||
let halfWidth;
|
||||
|
||||
halfWidth = width / 2;
|
||||
|
||||
if (halfWidth % 2 === 0) {
|
||||
return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth);
|
||||
} else {
|
||||
halfWidth = Math.floor(halfWidth);
|
||||
|
||||
return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth + 1);
|
||||
}
|
||||
};
|
||||
|
||||
/**
|
||||
* Pads a string to the left and/or right to position the subject
|
||||
* text in a desired alignment within a container.
|
||||
*
|
||||
* @param {string} subject
|
||||
* @param {number} containerWidth
|
||||
* @param {string} alignment One of the valid options (left, right, center).
|
||||
* @returns {string}
|
||||
*/
|
||||
export default (subject, containerWidth, alignment) => {
|
||||
if (!_.isString(subject)) {
|
||||
throw new TypeError('Subject parameter value must be a string.');
|
||||
}
|
||||
|
||||
if (!_.isNumber(containerWidth)) {
|
||||
throw new TypeError('Container width parameter value must be a number.');
|
||||
}
|
||||
|
||||
const subjectWidth = stringWidth(subject);
|
||||
|
||||
if (subjectWidth > containerWidth) {
|
||||
// console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject);
|
||||
|
||||
throw new Error('Subject parameter value width cannot be greater than the container width.');
|
||||
}
|
||||
|
||||
if (!_.isString(alignment)) {
|
||||
throw new TypeError('Alignment parameter value must be a string.');
|
||||
}
|
||||
|
||||
if (alignments.indexOf(alignment) === -1) {
|
||||
throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).');
|
||||
}
|
||||
|
||||
if (subjectWidth === 0) {
|
||||
return ' '.repeat(containerWidth);
|
||||
}
|
||||
|
||||
const availableWidth = containerWidth - subjectWidth;
|
||||
|
||||
if (alignment === 'left') {
|
||||
return alignLeft(subject, availableWidth);
|
||||
}
|
||||
|
||||
if (alignment === 'right') {
|
||||
return alignRight(subject, availableWidth);
|
||||
}
|
||||
|
||||
return alignCenter(subject, availableWidth);
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/alignString.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/alignString.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/alignString.js"],"names":["alignments","alignLeft","subject","width","repeat","alignRight","alignCenter","halfWidth","Math","floor","containerWidth","alignment","_","isString","TypeError","isNumber","subjectWidth","Error","indexOf","availableWidth"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA,MAAMA,UAAU,GAAG,CACjB,MADiB,EAEjB,OAFiB,EAGjB,QAHiB,CAAnB;AAMA;;;;;;AAKA,MAAMC,SAAS,GAAG,CAACC,OAAD,EAAUC,KAAV,KAAoB;AACpC,SAAOD,OAAO,GAAG,IAAIE,MAAJ,CAAWD,KAAX,CAAjB;AACD,CAFD;AAIA;;;;;;;AAKA,MAAME,UAAU,GAAG,CAACH,OAAD,EAAUC,KAAV,KAAoB;AACrC,SAAO,IAAIC,MAAJ,CAAWD,KAAX,IAAoBD,OAA3B;AACD,CAFD;AAIA;;;;;;;AAKA,MAAMI,WAAW,GAAG,CAACJ,OAAD,EAAUC,KAAV,KAAoB;AACtC,MAAII,SAAJ;AAEAA,EAAAA,SAAS,GAAGJ,KAAK,GAAG,CAApB;;AAEA,MAAII,SAAS,GAAG,CAAZ,KAAkB,CAAtB,EAAyB;AACvB,WAAO,IAAIH,MAAJ,CAAWG,SAAX,IAAwBL,OAAxB,GAAkC,IAAIE,MAAJ,CAAWG,SAAX,CAAzC;AACD,GAFD,MAEO;AACLA,IAAAA,SAAS,GAAGC,IAAI,CAACC,KAAL,CAAWF,SAAX,CAAZ;AAEA,WAAO,IAAIH,MAAJ,CAAWG,SAAX,IAAwBL,OAAxB,GAAkC,IAAIE,MAAJ,CAAWG,SAAS,GAAG,CAAvB,CAAzC;AACD;AACF,CAZD;AAcA;;;;;;;;;;;qBASgBL,O,EAASQ,c,EAAgBC,S,KAAc;AACrD,MAAI,CAACC,gBAAEC,QAAF,CAAWX,OAAX,CAAL,EAA0B;AACxB,UAAM,IAAIY,SAAJ,CAAc,2CAAd,CAAN;AACD;;AAED,MAAI,CAACF,gBAAEG,QAAF,CAAWL,cAAX,CAAL,EAAiC;AAC/B,UAAM,IAAII,SAAJ,CAAc,mDAAd,CAAN;AACD;;AAED,QAAME,YAAY,GAAG,0BAAYd,OAAZ,CAArB;;AAEA,MAAIc,YAAY,GAAGN,cAAnB,EAAmC;AACjC;AAEA,UAAM,IAAIO,KAAJ,CAAU,2EAAV,CAAN;AACD;;AAED,MAAI,CAACL,gBAAEC,QAAF,CAAWF,SAAX,CAAL,EAA4B;AAC1B,UAAM,IAAIG,SAAJ,CAAc,6CAAd,CAAN;AACD;;AAED,MAAId,UAAU,CAACkB,OAAX,CAAmBP,SAAnB,MAAkC,CAAC,CAAvC,EAA0C;AACxC,UAAM,IAAIM,KAAJ,CAAU,4FAAV,CAAN;AACD;;AAED,MAAID,YAAY,KAAK,CAArB,EAAwB;AACtB,WAAO,IAAIZ,MAAJ,CAAWM,cAAX,CAAP;AACD;;AAED,QAAMS,cAAc,GAAGT,cAAc,GAAGM,YAAxC;;AAEA,MAAIL,SAAS,KAAK,MAAlB,EAA0B;AACxB,WAAOV,SAAS,CAACC,OAAD,EAAUiB,cAAV,CAAhB;AACD;;AAED,MAAIR,SAAS,KAAK,OAAlB,EAA2B;AACzB,WAAON,UAAU,CAACH,OAAD,EAAUiB,cAAV,CAAjB;AACD;;AAED,SAAOb,WAAW,CAACJ,OAAD,EAAUiB,cAAV,CAAlB;AACD,C","sourcesContent":["import _ from 'lodash';\nimport stringWidth from 'string-width';\n\nconst alignments = [\n 'left',\n 'right',\n 'center'\n];\n\n/**\n * @param {string} subject\n * @param {number} width\n * @returns {string}\n */\nconst alignLeft = (subject, width) => {\n return subject + ' '.repeat(width);\n};\n\n/**\n * @param {string} subject\n * @param {number} width\n * @returns {string}\n */\nconst alignRight = (subject, width) => {\n return ' '.repeat(width) + subject;\n};\n\n/**\n * @param {string} subject\n * @param {number} width\n * @returns {string}\n */\nconst alignCenter = (subject, width) => {\n let halfWidth;\n\n halfWidth = width / 2;\n\n if (halfWidth % 2 === 0) {\n return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth);\n } else {\n halfWidth = Math.floor(halfWidth);\n\n return ' '.repeat(halfWidth) + subject + ' '.repeat(halfWidth + 1);\n }\n};\n\n/**\n * Pads a string to the left and/or right to position the subject\n * text in a desired alignment within a container.\n *\n * @param {string} subject\n * @param {number} containerWidth\n * @param {string} alignment One of the valid options (left, right, center).\n * @returns {string}\n */\nexport default (subject, containerWidth, alignment) => {\n if (!_.isString(subject)) {\n throw new TypeError('Subject parameter value must be a string.');\n }\n\n if (!_.isNumber(containerWidth)) {\n throw new TypeError('Container width parameter value must be a number.');\n }\n\n const subjectWidth = stringWidth(subject);\n\n if (subjectWidth > containerWidth) {\n // console.log('subjectWidth', subjectWidth, 'containerWidth', containerWidth, 'subject', subject);\n\n throw new Error('Subject parameter value width cannot be greater than the container width.');\n }\n\n if (!_.isString(alignment)) {\n throw new TypeError('Alignment parameter value must be a string.');\n }\n\n if (alignments.indexOf(alignment) === -1) {\n throw new Error('Alignment parameter value must be a known alignment parameter value (left, right, center).');\n }\n\n if (subjectWidth === 0) {\n return ' '.repeat(containerWidth);\n }\n\n const availableWidth = containerWidth - subjectWidth;\n\n if (alignment === 'left') {\n return alignLeft(subject, availableWidth);\n }\n\n if (alignment === 'right') {\n return alignRight(subject, availableWidth);\n }\n\n return alignCenter(subject, availableWidth);\n};\n"],"file":"alignString.js"}
|
23
tools/node_modules/eslint/node_modules/table/dist/alignTableData.js
generated
vendored
23
tools/node_modules/eslint/node_modules/table/dist/alignTableData.js
generated
vendored
@ -1,16 +1,13 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _stringWidth = require('string-width');
|
||||
var _stringWidth = _interopRequireDefault(require("string-width"));
|
||||
|
||||
var _stringWidth2 = _interopRequireDefault(_stringWidth);
|
||||
|
||||
var _alignString = require('./alignString');
|
||||
|
||||
var _alignString2 = _interopRequireDefault(_alignString);
|
||||
var _alignString = _interopRequireDefault(require("./alignString"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -19,16 +16,20 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
* @param {Object} config
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
exports.default = (rows, config) => {
|
||||
const alignTableData = (rows, config) => {
|
||||
return rows.map(cells => {
|
||||
return cells.map((value, index1) => {
|
||||
const column = config.columns[index1];
|
||||
|
||||
if ((0, _stringWidth2.default)(value) === column.width) {
|
||||
if ((0, _stringWidth.default)(value) === column.width) {
|
||||
return value;
|
||||
} else {
|
||||
return (0, _alignString2.default)(value, column.width, column.alignment);
|
||||
return (0, _alignString.default)(value, column.width, column.alignment);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _default = alignTableData;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=alignTableData.js.map
|
21
tools/node_modules/eslint/node_modules/table/dist/alignTableData.js.flow
generated
vendored
Normal file
21
tools/node_modules/eslint/node_modules/table/dist/alignTableData.js.flow
generated
vendored
Normal file
@ -0,0 +1,21 @@
|
||||
import stringWidth from 'string-width';
|
||||
import alignString from './alignString';
|
||||
|
||||
/**
|
||||
* @param {table~row[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {table~row[]}
|
||||
*/
|
||||
export default (rows, config) => {
|
||||
return rows.map((cells) => {
|
||||
return cells.map((value, index1) => {
|
||||
const column = config.columns[index1];
|
||||
|
||||
if (stringWidth(value) === column.width) {
|
||||
return value;
|
||||
} else {
|
||||
return alignString(value, column.width, column.alignment);
|
||||
}
|
||||
});
|
||||
});
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/alignTableData.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/alignTableData.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/alignTableData.js"],"names":["rows","config","map","cells","value","index1","column","columns","width","alignment"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA;;;;;wBAKgBA,I,EAAMC,M,KAAW;AAC/B,SAAOD,IAAI,CAACE,GAAL,CAAUC,KAAD,IAAW;AACzB,WAAOA,KAAK,CAACD,GAAN,CAAU,CAACE,KAAD,EAAQC,MAAR,KAAmB;AAClC,YAAMC,MAAM,GAAGL,MAAM,CAACM,OAAP,CAAeF,MAAf,CAAf;;AAEA,UAAI,0BAAYD,KAAZ,MAAuBE,MAAM,CAACE,KAAlC,EAAyC;AACvC,eAAOJ,KAAP;AACD,OAFD,MAEO;AACL,eAAO,0BAAYA,KAAZ,EAAmBE,MAAM,CAACE,KAA1B,EAAiCF,MAAM,CAACG,SAAxC,CAAP;AACD;AACF,KARM,CAAP;AASD,GAVM,CAAP;AAWD,C","sourcesContent":["import stringWidth from 'string-width';\nimport alignString from './alignString';\n\n/**\n * @param {table~row[]} rows\n * @param {Object} config\n * @returns {table~row[]}\n */\nexport default (rows, config) => {\n return rows.map((cells) => {\n return cells.map((value, index1) => {\n const column = config.columns[index1];\n\n if (stringWidth(value) === column.width) {\n return value;\n } else {\n return alignString(value, column.width, column.alignment);\n }\n });\n });\n};\n"],"file":"alignTableData.js"}
|
31
tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js
generated
vendored
31
tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js
generated
vendored
@ -1,20 +1,15 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _lodash = require('lodash');
|
||||
var _lodash = _interopRequireDefault(require("lodash"));
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
var _stringWidth = _interopRequireDefault(require("string-width"));
|
||||
|
||||
var _stringWidth = require('string-width');
|
||||
|
||||
var _stringWidth2 = _interopRequireDefault(_stringWidth);
|
||||
|
||||
var _wrapWord = require('./wrapWord');
|
||||
|
||||
var _wrapWord2 = _interopRequireDefault(_wrapWord);
|
||||
var _wrapWord = _interopRequireDefault(require("./wrapWord"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -24,10 +19,8 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
* @param {boolean} useWrapWord
|
||||
* @returns {number}
|
||||
*/
|
||||
exports.default = function (value, columnWidth) {
|
||||
let useWrapWord = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : false;
|
||||
|
||||
if (!_lodash2.default.isString(value)) {
|
||||
const calculateCellHeight = (value, columnWidth, useWrapWord = false) => {
|
||||
if (!_lodash.default.isString(value)) {
|
||||
throw new TypeError('Value must be a string.');
|
||||
}
|
||||
|
||||
@ -40,8 +33,12 @@ exports.default = function (value, columnWidth) {
|
||||
}
|
||||
|
||||
if (useWrapWord) {
|
||||
return (0, _wrapWord2.default)(value, columnWidth).length;
|
||||
return (0, _wrapWord.default)(value, columnWidth).length;
|
||||
}
|
||||
|
||||
return Math.ceil((0, _stringWidth2.default)(value) / columnWidth);
|
||||
};
|
||||
return Math.ceil((0, _stringWidth.default)(value) / columnWidth);
|
||||
};
|
||||
|
||||
var _default = calculateCellHeight;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=calculateCellHeight.js.map
|
29
tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js.flow
generated
vendored
Normal file
29
tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js.flow
generated
vendored
Normal file
@ -0,0 +1,29 @@
|
||||
import _ from 'lodash';
|
||||
import stringWidth from 'string-width';
|
||||
import wrapWord from './wrapWord';
|
||||
|
||||
/**
|
||||
* @param {string} value
|
||||
* @param {number} columnWidth
|
||||
* @param {boolean} useWrapWord
|
||||
* @returns {number}
|
||||
*/
|
||||
export default (value, columnWidth, useWrapWord = false) => {
|
||||
if (!_.isString(value)) {
|
||||
throw new TypeError('Value must be a string.');
|
||||
}
|
||||
|
||||
if (!Number.isInteger(columnWidth)) {
|
||||
throw new TypeError('Column width must be an integer.');
|
||||
}
|
||||
|
||||
if (columnWidth < 1) {
|
||||
throw new Error('Column width must be greater than 0.');
|
||||
}
|
||||
|
||||
if (useWrapWord) {
|
||||
return wrapWord(value, columnWidth).length;
|
||||
}
|
||||
|
||||
return Math.ceil(stringWidth(value) / columnWidth);
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/calculateCellHeight.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/calculateCellHeight.js"],"names":["value","columnWidth","useWrapWord","_","isString","TypeError","Number","isInteger","Error","length","Math","ceil"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;;;AAEA;;;;;;6BAMgBA,K,EAAOC,W,EAAaC,WAAW,GAAG,K,KAAU;AAC1D,MAAI,CAACC,gBAAEC,QAAF,CAAWJ,KAAX,CAAL,EAAwB;AACtB,UAAM,IAAIK,SAAJ,CAAc,yBAAd,CAAN;AACD;;AAED,MAAI,CAACC,MAAM,CAACC,SAAP,CAAiBN,WAAjB,CAAL,EAAoC;AAClC,UAAM,IAAII,SAAJ,CAAc,kCAAd,CAAN;AACD;;AAED,MAAIJ,WAAW,GAAG,CAAlB,EAAqB;AACnB,UAAM,IAAIO,KAAJ,CAAU,sCAAV,CAAN;AACD;;AAED,MAAIN,WAAJ,EAAiB;AACf,WAAO,uBAASF,KAAT,EAAgBC,WAAhB,EAA6BQ,MAApC;AACD;;AAED,SAAOC,IAAI,CAACC,IAAL,CAAU,0BAAYX,KAAZ,IAAqBC,WAA/B,CAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport stringWidth from 'string-width';\nimport wrapWord from './wrapWord';\n\n/**\n * @param {string} value\n * @param {number} columnWidth\n * @param {boolean} useWrapWord\n * @returns {number}\n */\nexport default (value, columnWidth, useWrapWord = false) => {\n if (!_.isString(value)) {\n throw new TypeError('Value must be a string.');\n }\n\n if (!Number.isInteger(columnWidth)) {\n throw new TypeError('Column width must be an integer.');\n }\n\n if (columnWidth < 1) {\n throw new Error('Column width must be greater than 0.');\n }\n\n if (useWrapWord) {\n return wrapWord(value, columnWidth).length;\n }\n\n return Math.ceil(stringWidth(value) / columnWidth);\n};\n"],"file":"calculateCellHeight.js"}
|
17
tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js
generated
vendored
17
tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js
generated
vendored
@ -1,12 +1,11 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _stringWidth = require('string-width');
|
||||
|
||||
var _stringWidth2 = _interopRequireDefault(_stringWidth);
|
||||
var _stringWidth = _interopRequireDefault(require("string-width"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -16,8 +15,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
* @param {string[]} cells
|
||||
* @returns {number[]}
|
||||
*/
|
||||
exports.default = cells => {
|
||||
const calculateCellWidthIndex = cells => {
|
||||
return cells.map(value => {
|
||||
return (0, _stringWidth2.default)(value);
|
||||
return (0, _stringWidth.default)(value);
|
||||
});
|
||||
};
|
||||
};
|
||||
|
||||
var _default = calculateCellWidthIndex;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=calculateCellWidthIndex.js.map
|
13
tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js.flow
generated
vendored
Normal file
13
tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js.flow
generated
vendored
Normal file
@ -0,0 +1,13 @@
|
||||
import stringWidth from 'string-width';
|
||||
|
||||
/**
|
||||
* Calculates width of each cell contents.
|
||||
*
|
||||
* @param {string[]} cells
|
||||
* @returns {number[]}
|
||||
*/
|
||||
export default (cells) => {
|
||||
return cells.map((value) => {
|
||||
return stringWidth(value);
|
||||
});
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/calculateCellWidthIndex.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/calculateCellWidthIndex.js"],"names":["cells","map","value"],"mappings":";;;;;;;AAAA;;;;AAEA;;;;;;gCAMgBA,K,IAAU;AACxB,SAAOA,KAAK,CAACC,GAAN,CAAWC,KAAD,IAAW;AAC1B,WAAO,0BAAYA,KAAZ,CAAP;AACD,GAFM,CAAP;AAGD,C","sourcesContent":["import stringWidth from 'string-width';\n\n/**\n * Calculates width of each cell contents.\n *\n * @param {string[]} cells\n * @returns {number[]}\n */\nexport default (cells) => {\n return cells.map((value) => {\n return stringWidth(value);\n });\n};\n"],"file":"calculateCellWidthIndex.js"}
|
22
tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js
generated
vendored
22
tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js
generated
vendored
@ -1,12 +1,11 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _calculateCellWidthIndex = require('./calculateCellWidthIndex');
|
||||
|
||||
var _calculateCellWidthIndex2 = _interopRequireDefault(_calculateCellWidthIndex);
|
||||
var _calculateCellWidthIndex = _interopRequireDefault(require("./calculateCellWidthIndex"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -16,22 +15,23 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
* @param {Array[]} rows
|
||||
* @returns {number[]}
|
||||
*/
|
||||
exports.default = rows => {
|
||||
const calculateMaximumColumnWidthIndex = rows => {
|
||||
if (!rows[0]) {
|
||||
throw new Error('Dataset must have at least one row.');
|
||||
}
|
||||
|
||||
const columns = Array(rows[0].length).fill(0);
|
||||
|
||||
const columns = new Array(rows[0].length).fill(0);
|
||||
rows.forEach(row => {
|
||||
const columnWidthIndex = (0, _calculateCellWidthIndex2.default)(row);
|
||||
|
||||
const columnWidthIndex = (0, _calculateCellWidthIndex.default)(row);
|
||||
columnWidthIndex.forEach((valueWidth, index0) => {
|
||||
if (columns[index0] < valueWidth) {
|
||||
columns[index0] = valueWidth;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return columns;
|
||||
};
|
||||
};
|
||||
|
||||
var _default = calculateMaximumColumnWidthIndex;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=calculateMaximumColumnWidthIndex.js.map
|
27
tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js.flow
generated
vendored
Normal file
27
tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js.flow
generated
vendored
Normal file
@ -0,0 +1,27 @@
|
||||
import calculateCellWidthIndex from './calculateCellWidthIndex';
|
||||
|
||||
/**
|
||||
* Produces an array of values that describe the largest value length (width) in every column.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @returns {number[]}
|
||||
*/
|
||||
export default (rows) => {
|
||||
if (!rows[0]) {
|
||||
throw new Error('Dataset must have at least one row.');
|
||||
}
|
||||
|
||||
const columns = new Array(rows[0].length).fill(0);
|
||||
|
||||
rows.forEach((row) => {
|
||||
const columnWidthIndex = calculateCellWidthIndex(row);
|
||||
|
||||
columnWidthIndex.forEach((valueWidth, index0) => {
|
||||
if (columns[index0] < valueWidth) {
|
||||
columns[index0] = valueWidth;
|
||||
}
|
||||
});
|
||||
});
|
||||
|
||||
return columns;
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/calculateMaximumColumnWidthIndex.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/calculateMaximumColumnWidthIndex.js"],"names":["rows","Error","columns","Array","length","fill","forEach","row","columnWidthIndex","valueWidth","index0"],"mappings":";;;;;;;AAAA;;;;AAEA;;;;;;yCAMgBA,I,IAAS;AACvB,MAAI,CAACA,IAAI,CAAC,CAAD,CAAT,EAAc;AACZ,UAAM,IAAIC,KAAJ,CAAU,qCAAV,CAAN;AACD;;AAED,QAAMC,OAAO,GAAG,IAAIC,KAAJ,CAAUH,IAAI,CAAC,CAAD,CAAJ,CAAQI,MAAlB,EAA0BC,IAA1B,CAA+B,CAA/B,CAAhB;AAEAL,EAAAA,IAAI,CAACM,OAAL,CAAcC,GAAD,IAAS;AACpB,UAAMC,gBAAgB,GAAG,sCAAwBD,GAAxB,CAAzB;AAEAC,IAAAA,gBAAgB,CAACF,OAAjB,CAAyB,CAACG,UAAD,EAAaC,MAAb,KAAwB;AAC/C,UAAIR,OAAO,CAACQ,MAAD,CAAP,GAAkBD,UAAtB,EAAkC;AAChCP,QAAAA,OAAO,CAACQ,MAAD,CAAP,GAAkBD,UAAlB;AACD;AACF,KAJD;AAKD,GARD;AAUA,SAAOP,OAAP;AACD,C","sourcesContent":["import calculateCellWidthIndex from './calculateCellWidthIndex';\n\n/**\n * Produces an array of values that describe the largest value length (width) in every column.\n *\n * @param {Array[]} rows\n * @returns {number[]}\n */\nexport default (rows) => {\n if (!rows[0]) {\n throw new Error('Dataset must have at least one row.');\n }\n\n const columns = new Array(rows[0].length).fill(0);\n\n rows.forEach((row) => {\n const columnWidthIndex = calculateCellWidthIndex(row);\n\n columnWidthIndex.forEach((valueWidth, index0) => {\n if (columns[index0] < valueWidth) {\n columns[index0] = valueWidth;\n }\n });\n });\n\n return columns;\n};\n"],"file":"calculateMaximumColumnWidthIndex.js"}
|
34
tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js
generated
vendored
34
tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js
generated
vendored
@ -1,16 +1,13 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _lodash = require('lodash');
|
||||
var _lodash = _interopRequireDefault(require("lodash"));
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
|
||||
var _calculateCellHeight = require('./calculateCellHeight');
|
||||
|
||||
var _calculateCellHeight2 = _interopRequireDefault(_calculateCellHeight);
|
||||
var _calculateCellHeight = _interopRequireDefault(require("./calculateCellHeight"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -21,28 +18,27 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
* @param {Object} config
|
||||
* @returns {number[]}
|
||||
*/
|
||||
exports.default = (rows, config) => {
|
||||
const calculateRowHeightIndex = (rows, config) => {
|
||||
const tableWidth = rows[0].length;
|
||||
|
||||
const rowSpanIndex = [];
|
||||
|
||||
rows.forEach(cells => {
|
||||
const cellHeightIndex = Array(tableWidth).fill(1);
|
||||
|
||||
const cellHeightIndex = new Array(tableWidth).fill(1);
|
||||
cells.forEach((value, index1) => {
|
||||
if (!_lodash2.default.isNumber(config.columns[index1].width)) {
|
||||
if (!_lodash.default.isNumber(config.columns[index1].width)) {
|
||||
throw new TypeError('column[index].width must be a number.');
|
||||
}
|
||||
|
||||
if (!_lodash2.default.isBoolean(config.columns[index1].wrapWord)) {
|
||||
if (!_lodash.default.isBoolean(config.columns[index1].wrapWord)) {
|
||||
throw new TypeError('column[index].wrapWord must be a boolean.');
|
||||
}
|
||||
|
||||
cellHeightIndex[index1] = (0, _calculateCellHeight2.default)(value, config.columns[index1].width, config.columns[index1].wrapWord);
|
||||
cellHeightIndex[index1] = (0, _calculateCellHeight.default)(value, config.columns[index1].width, config.columns[index1].wrapWord);
|
||||
});
|
||||
|
||||
rowSpanIndex.push(_lodash2.default.max(cellHeightIndex));
|
||||
rowSpanIndex.push(_lodash.default.max(cellHeightIndex));
|
||||
});
|
||||
|
||||
return rowSpanIndex;
|
||||
};
|
||||
};
|
||||
|
||||
var _default = calculateRowHeightIndex;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=calculateRowHeightIndex.js.map
|
35
tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js.flow
generated
vendored
Normal file
35
tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js.flow
generated
vendored
Normal file
@ -0,0 +1,35 @@
|
||||
import _ from 'lodash';
|
||||
import calculateCellHeight from './calculateCellHeight';
|
||||
|
||||
/**
|
||||
* Calculates the vertical row span index.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @param {Object} config
|
||||
* @returns {number[]}
|
||||
*/
|
||||
export default (rows, config) => {
|
||||
const tableWidth = rows[0].length;
|
||||
|
||||
const rowSpanIndex = [];
|
||||
|
||||
rows.forEach((cells) => {
|
||||
const cellHeightIndex = new Array(tableWidth).fill(1);
|
||||
|
||||
cells.forEach((value, index1) => {
|
||||
if (!_.isNumber(config.columns[index1].width)) {
|
||||
throw new TypeError('column[index].width must be a number.');
|
||||
}
|
||||
|
||||
if (!_.isBoolean(config.columns[index1].wrapWord)) {
|
||||
throw new TypeError('column[index].wrapWord must be a boolean.');
|
||||
}
|
||||
|
||||
cellHeightIndex[index1] = calculateCellHeight(value, config.columns[index1].width, config.columns[index1].wrapWord);
|
||||
});
|
||||
|
||||
rowSpanIndex.push(_.max(cellHeightIndex));
|
||||
});
|
||||
|
||||
return rowSpanIndex;
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/calculateRowHeightIndex.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/calculateRowHeightIndex.js"],"names":["rows","config","tableWidth","length","rowSpanIndex","forEach","cells","cellHeightIndex","Array","fill","value","index1","_","isNumber","columns","width","TypeError","isBoolean","wrapWord","push","max"],"mappings":";;;;;;;AAAA;;AACA;;;;AAEA;;;;;;;iCAOgBA,I,EAAMC,M,KAAW;AAC/B,QAAMC,UAAU,GAAGF,IAAI,CAAC,CAAD,CAAJ,CAAQG,MAA3B;AAEA,QAAMC,YAAY,GAAG,EAArB;AAEAJ,EAAAA,IAAI,CAACK,OAAL,CAAcC,KAAD,IAAW;AACtB,UAAMC,eAAe,GAAG,IAAIC,KAAJ,CAAUN,UAAV,EAAsBO,IAAtB,CAA2B,CAA3B,CAAxB;AAEAH,IAAAA,KAAK,CAACD,OAAN,CAAc,CAACK,KAAD,EAAQC,MAAR,KAAmB;AAC/B,UAAI,CAACC,gBAAEC,QAAF,CAAWZ,MAAM,CAACa,OAAP,CAAeH,MAAf,EAAuBI,KAAlC,CAAL,EAA+C;AAC7C,cAAM,IAAIC,SAAJ,CAAc,uCAAd,CAAN;AACD;;AAED,UAAI,CAACJ,gBAAEK,SAAF,CAAYhB,MAAM,CAACa,OAAP,CAAeH,MAAf,EAAuBO,QAAnC,CAAL,EAAmD;AACjD,cAAM,IAAIF,SAAJ,CAAc,2CAAd,CAAN;AACD;;AAEDT,MAAAA,eAAe,CAACI,MAAD,CAAf,GAA0B,kCAAoBD,KAApB,EAA2BT,MAAM,CAACa,OAAP,CAAeH,MAAf,EAAuBI,KAAlD,EAAyDd,MAAM,CAACa,OAAP,CAAeH,MAAf,EAAuBO,QAAhF,CAA1B;AACD,KAVD;AAYAd,IAAAA,YAAY,CAACe,IAAb,CAAkBP,gBAAEQ,GAAF,CAAMb,eAAN,CAAlB;AACD,GAhBD;AAkBA,SAAOH,YAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport calculateCellHeight from './calculateCellHeight';\n\n/**\n * Calculates the vertical row span index.\n *\n * @param {Array[]} rows\n * @param {Object} config\n * @returns {number[]}\n */\nexport default (rows, config) => {\n const tableWidth = rows[0].length;\n\n const rowSpanIndex = [];\n\n rows.forEach((cells) => {\n const cellHeightIndex = new Array(tableWidth).fill(1);\n\n cells.forEach((value, index1) => {\n if (!_.isNumber(config.columns[index1].width)) {\n throw new TypeError('column[index].width must be a number.');\n }\n\n if (!_.isBoolean(config.columns[index1].wrapWord)) {\n throw new TypeError('column[index].wrapWord must be a boolean.');\n }\n\n cellHeightIndex[index1] = calculateCellHeight(value, config.columns[index1].width, config.columns[index1].wrapWord);\n });\n\n rowSpanIndex.push(_.max(cellHeightIndex));\n });\n\n return rowSpanIndex;\n};\n"],"file":"calculateRowHeightIndex.js"}
|
103
tools/node_modules/eslint/node_modules/table/dist/createStream.js
generated
vendored
103
tools/node_modules/eslint/node_modules/table/dist/createStream.js
generated
vendored
@ -1,46 +1,29 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _lodash = require('lodash');
|
||||
var _lodash = _interopRequireDefault(require("lodash"));
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
var _makeStreamConfig = _interopRequireDefault(require("./makeStreamConfig"));
|
||||
|
||||
var _makeStreamConfig = require('./makeStreamConfig');
|
||||
var _drawRow = _interopRequireDefault(require("./drawRow"));
|
||||
|
||||
var _makeStreamConfig2 = _interopRequireDefault(_makeStreamConfig);
|
||||
var _drawBorder = require("./drawBorder");
|
||||
|
||||
var _drawRow = require('./drawRow');
|
||||
var _stringifyTableData = _interopRequireDefault(require("./stringifyTableData"));
|
||||
|
||||
var _drawRow2 = _interopRequireDefault(_drawRow);
|
||||
var _truncateTableData = _interopRequireDefault(require("./truncateTableData"));
|
||||
|
||||
var _drawBorder = require('./drawBorder');
|
||||
var _mapDataUsingRowHeightIndex = _interopRequireDefault(require("./mapDataUsingRowHeightIndex"));
|
||||
|
||||
var _stringifyTableData = require('./stringifyTableData');
|
||||
var _alignTableData = _interopRequireDefault(require("./alignTableData"));
|
||||
|
||||
var _stringifyTableData2 = _interopRequireDefault(_stringifyTableData);
|
||||
var _padTableData = _interopRequireDefault(require("./padTableData"));
|
||||
|
||||
var _truncateTableData = require('./truncateTableData');
|
||||
|
||||
var _truncateTableData2 = _interopRequireDefault(_truncateTableData);
|
||||
|
||||
var _mapDataUsingRowHeightIndex = require('./mapDataUsingRowHeightIndex');
|
||||
|
||||
var _mapDataUsingRowHeightIndex2 = _interopRequireDefault(_mapDataUsingRowHeightIndex);
|
||||
|
||||
var _alignTableData = require('./alignTableData');
|
||||
|
||||
var _alignTableData2 = _interopRequireDefault(_alignTableData);
|
||||
|
||||
var _padTableData = require('./padTableData');
|
||||
|
||||
var _padTableData2 = _interopRequireDefault(_padTableData);
|
||||
|
||||
var _calculateRowHeightIndex = require('./calculateRowHeightIndex');
|
||||
|
||||
var _calculateRowHeightIndex2 = _interopRequireDefault(_calculateRowHeightIndex);
|
||||
var _calculateRowHeightIndex = _interopRequireDefault(require("./calculateRowHeightIndex"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -51,90 +34,71 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
*/
|
||||
const prepareData = (data, config) => {
|
||||
let rows;
|
||||
|
||||
rows = (0, _stringifyTableData2.default)(data);
|
||||
|
||||
rows = (0, _truncateTableData2.default)(data, config);
|
||||
|
||||
const rowHeightIndex = (0, _calculateRowHeightIndex2.default)(rows, config);
|
||||
|
||||
rows = (0, _mapDataUsingRowHeightIndex2.default)(rows, rowHeightIndex, config);
|
||||
rows = (0, _alignTableData2.default)(rows, config);
|
||||
rows = (0, _padTableData2.default)(rows, config);
|
||||
|
||||
rows = (0, _stringifyTableData.default)(data);
|
||||
rows = (0, _truncateTableData.default)(data, config);
|
||||
const rowHeightIndex = (0, _calculateRowHeightIndex.default)(rows, config);
|
||||
rows = (0, _mapDataUsingRowHeightIndex.default)(rows, rowHeightIndex, config);
|
||||
rows = (0, _alignTableData.default)(rows, config);
|
||||
rows = (0, _padTableData.default)(rows, config);
|
||||
return rows;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @param {number[]} columnWidthIndex
|
||||
* @param {Object} config
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
|
||||
const create = (row, columnWidthIndex, config) => {
|
||||
const rows = prepareData([row], config);
|
||||
|
||||
const body = rows.map(literalRow => {
|
||||
return (0, _drawRow2.default)(literalRow, config.border);
|
||||
return (0, _drawRow.default)(literalRow, config.border);
|
||||
}).join('');
|
||||
|
||||
let output;
|
||||
|
||||
output = '';
|
||||
|
||||
output += (0, _drawBorder.drawBorderTop)(columnWidthIndex, config.border);
|
||||
output += body;
|
||||
output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border);
|
||||
|
||||
output = _lodash2.default.trimEnd(output);
|
||||
|
||||
output = _lodash.default.trimEnd(output);
|
||||
process.stdout.write(output);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @param {number[]} columnWidthIndex
|
||||
* @param {Object} config
|
||||
* @returns {undefined}
|
||||
*/
|
||||
|
||||
|
||||
const append = (row, columnWidthIndex, config) => {
|
||||
const rows = prepareData([row], config);
|
||||
|
||||
const body = rows.map(literalRow => {
|
||||
return (0, _drawRow2.default)(literalRow, config.border);
|
||||
return (0, _drawRow.default)(literalRow, config.border);
|
||||
}).join('');
|
||||
|
||||
let output;
|
||||
|
||||
output = '\r\u001B[K';
|
||||
|
||||
output += (0, _drawBorder.drawBorderJoin)(columnWidthIndex, config.border);
|
||||
output += body;
|
||||
output += (0, _drawBorder.drawBorderBottom)(columnWidthIndex, config.border);
|
||||
|
||||
output = _lodash2.default.trimEnd(output);
|
||||
|
||||
output = _lodash.default.trimEnd(output);
|
||||
process.stdout.write(output);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Object} userConfig
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
||||
exports.default = function () {
|
||||
let userConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
const config = (0, _makeStreamConfig2.default)(userConfig);
|
||||
const createStream = (userConfig = {}) => {
|
||||
const config = (0, _makeStreamConfig.default)(userConfig); // @todo Use 'Object.values' when Node.js v6 support is dropped.
|
||||
|
||||
const columnWidthIndex = _lodash2.default.mapValues(config.columns, column => {
|
||||
const columnWidthIndex = _lodash.default.values(_lodash.default.mapValues(config.columns, column => {
|
||||
return column.width + column.paddingLeft + column.paddingRight;
|
||||
});
|
||||
}));
|
||||
|
||||
let empty;
|
||||
|
||||
empty = true;
|
||||
|
||||
return {
|
||||
/**
|
||||
* @param {string[]} row
|
||||
@ -147,11 +111,14 @@ exports.default = function () {
|
||||
|
||||
if (empty) {
|
||||
empty = false;
|
||||
|
||||
return create(row, columnWidthIndex, config);
|
||||
} else {
|
||||
return append(row, columnWidthIndex, config);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
||||
};
|
||||
|
||||
var _default = createStream;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=createStream.js.map
|
124
tools/node_modules/eslint/node_modules/table/dist/createStream.js.flow
generated
vendored
Normal file
124
tools/node_modules/eslint/node_modules/table/dist/createStream.js.flow
generated
vendored
Normal file
@ -0,0 +1,124 @@
|
||||
import _ from 'lodash';
|
||||
import makeStreamConfig from './makeStreamConfig';
|
||||
import drawRow from './drawRow';
|
||||
import {
|
||||
drawBorderBottom,
|
||||
drawBorderJoin,
|
||||
drawBorderTop
|
||||
} from './drawBorder';
|
||||
import stringifyTableData from './stringifyTableData';
|
||||
import truncateTableData from './truncateTableData';
|
||||
import mapDataUsingRowHeightIndex from './mapDataUsingRowHeightIndex';
|
||||
import alignTableData from './alignTableData';
|
||||
import padTableData from './padTableData';
|
||||
import calculateRowHeightIndex from './calculateRowHeightIndex';
|
||||
|
||||
/**
|
||||
* @param {Array} data
|
||||
* @param {Object} config
|
||||
* @returns {Array}
|
||||
*/
|
||||
const prepareData = (data, config) => {
|
||||
let rows;
|
||||
|
||||
rows = stringifyTableData(data);
|
||||
|
||||
rows = truncateTableData(data, config);
|
||||
|
||||
const rowHeightIndex = calculateRowHeightIndex(rows, config);
|
||||
|
||||
rows = mapDataUsingRowHeightIndex(rows, rowHeightIndex, config);
|
||||
rows = alignTableData(rows, config);
|
||||
rows = padTableData(rows, config);
|
||||
|
||||
return rows;
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @param {number[]} columnWidthIndex
|
||||
* @param {Object} config
|
||||
* @returns {undefined}
|
||||
*/
|
||||
const create = (row, columnWidthIndex, config) => {
|
||||
const rows = prepareData([row], config);
|
||||
|
||||
const body = rows.map((literalRow) => {
|
||||
return drawRow(literalRow, config.border);
|
||||
}).join('');
|
||||
|
||||
let output;
|
||||
|
||||
output = '';
|
||||
|
||||
output += drawBorderTop(columnWidthIndex, config.border);
|
||||
output += body;
|
||||
output += drawBorderBottom(columnWidthIndex, config.border);
|
||||
|
||||
output = _.trimEnd(output);
|
||||
|
||||
process.stdout.write(output);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @param {number[]} columnWidthIndex
|
||||
* @param {Object} config
|
||||
* @returns {undefined}
|
||||
*/
|
||||
const append = (row, columnWidthIndex, config) => {
|
||||
const rows = prepareData([row], config);
|
||||
|
||||
const body = rows.map((literalRow) => {
|
||||
return drawRow(literalRow, config.border);
|
||||
}).join('');
|
||||
|
||||
let output;
|
||||
|
||||
output = '\r\u001B[K';
|
||||
|
||||
output += drawBorderJoin(columnWidthIndex, config.border);
|
||||
output += body;
|
||||
output += drawBorderBottom(columnWidthIndex, config.border);
|
||||
|
||||
output = _.trimEnd(output);
|
||||
|
||||
process.stdout.write(output);
|
||||
};
|
||||
|
||||
/**
|
||||
* @param {Object} userConfig
|
||||
* @returns {Object}
|
||||
*/
|
||||
export default (userConfig = {}) => {
|
||||
const config = makeStreamConfig(userConfig);
|
||||
|
||||
// @todo Use 'Object.values' when Node.js v6 support is dropped.
|
||||
const columnWidthIndex = _.values(_.mapValues(config.columns, (column) => {
|
||||
return column.width + column.paddingLeft + column.paddingRight;
|
||||
}));
|
||||
|
||||
let empty;
|
||||
|
||||
empty = true;
|
||||
|
||||
return {
|
||||
/**
|
||||
* @param {string[]} row
|
||||
* @returns {undefined}
|
||||
*/
|
||||
write: (row) => {
|
||||
if (row.length !== config.columnCount) {
|
||||
throw new Error('Row cell count does not match the config.columnCount.');
|
||||
}
|
||||
|
||||
if (empty) {
|
||||
empty = false;
|
||||
|
||||
return create(row, columnWidthIndex, config);
|
||||
} else {
|
||||
return append(row, columnWidthIndex, config);
|
||||
}
|
||||
}
|
||||
};
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/createStream.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/createStream.js.map
generated
vendored
Normal file
File diff suppressed because one or more lines are too long
24
tools/node_modules/eslint/node_modules/table/dist/drawBorder.js
generated
vendored
24
tools/node_modules/eslint/node_modules/table/dist/drawBorder.js
generated
vendored
@ -1,8 +1,10 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.drawBorderTop = exports.drawBorderJoin = exports.drawBorderBottom = exports.drawBorder = void 0;
|
||||
|
||||
/**
|
||||
* @typedef drawBorder~parts
|
||||
* @property {string} left
|
||||
@ -20,10 +22,8 @@ const drawBorder = (columnSizeIndex, parts) => {
|
||||
const columns = columnSizeIndex.map(size => {
|
||||
return parts.body.repeat(size);
|
||||
}).join(parts.join);
|
||||
|
||||
return parts.left + columns + parts.right + '\n';
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef drawBorderTop~parts
|
||||
* @property {string} topLeft
|
||||
@ -37,6 +37,10 @@ const drawBorder = (columnSizeIndex, parts) => {
|
||||
* @param {drawBorderTop~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
exports.drawBorder = drawBorder;
|
||||
|
||||
const drawBorderTop = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.topBody,
|
||||
@ -45,7 +49,6 @@ const drawBorderTop = (columnSizeIndex, parts) => {
|
||||
right: parts.topRight
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef drawBorderJoin~parts
|
||||
* @property {string} joinLeft
|
||||
@ -59,6 +62,10 @@ const drawBorderTop = (columnSizeIndex, parts) => {
|
||||
* @param {drawBorderJoin~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
exports.drawBorderTop = drawBorderTop;
|
||||
|
||||
const drawBorderJoin = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.joinBody,
|
||||
@ -67,7 +74,6 @@ const drawBorderJoin = (columnSizeIndex, parts) => {
|
||||
right: parts.joinRight
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef drawBorderBottom~parts
|
||||
* @property {string} topLeft
|
||||
@ -81,6 +87,10 @@ const drawBorderJoin = (columnSizeIndex, parts) => {
|
||||
* @param {drawBorderBottom~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
|
||||
|
||||
exports.drawBorderJoin = drawBorderJoin;
|
||||
|
||||
const drawBorderBottom = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.bottomBody,
|
||||
@ -90,7 +100,5 @@ const drawBorderBottom = (columnSizeIndex, parts) => {
|
||||
});
|
||||
};
|
||||
|
||||
exports.drawBorder = drawBorder;
|
||||
exports.drawBorderBottom = drawBorderBottom;
|
||||
exports.drawBorderJoin = drawBorderJoin;
|
||||
exports.drawBorderTop = drawBorderTop;
|
||||
//# sourceMappingURL=drawBorder.js.map
|
95
tools/node_modules/eslint/node_modules/table/dist/drawBorder.js.flow
generated
vendored
Normal file
95
tools/node_modules/eslint/node_modules/table/dist/drawBorder.js.flow
generated
vendored
Normal file
@ -0,0 +1,95 @@
|
||||
/**
|
||||
* @typedef drawBorder~parts
|
||||
* @property {string} left
|
||||
* @property {string} right
|
||||
* @property {string} body
|
||||
* @property {string} join
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorder~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorder = (columnSizeIndex, parts) => {
|
||||
const columns = columnSizeIndex
|
||||
.map((size) => {
|
||||
return parts.body.repeat(size);
|
||||
})
|
||||
.join(parts.join);
|
||||
|
||||
return parts.left + columns + parts.right + '\n';
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef drawBorderTop~parts
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorderTop~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorderTop = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.topBody,
|
||||
join: parts.topJoin,
|
||||
left: parts.topLeft,
|
||||
right: parts.topRight
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef drawBorderJoin~parts
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorderJoin~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorderJoin = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.joinBody,
|
||||
join: parts.joinJoin,
|
||||
left: parts.joinLeft,
|
||||
right: parts.joinRight
|
||||
});
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef drawBorderBottom~parts
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columnSizeIndex
|
||||
* @param {drawBorderBottom~parts} parts
|
||||
* @returns {string}
|
||||
*/
|
||||
const drawBorderBottom = (columnSizeIndex, parts) => {
|
||||
return drawBorder(columnSizeIndex, {
|
||||
body: parts.bottomBody,
|
||||
join: parts.bottomJoin,
|
||||
left: parts.bottomLeft,
|
||||
right: parts.bottomRight
|
||||
});
|
||||
};
|
||||
|
||||
export {
|
||||
drawBorder,
|
||||
drawBorderBottom,
|
||||
drawBorderJoin,
|
||||
drawBorderTop
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/drawBorder.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/drawBorder.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/drawBorder.js"],"names":["drawBorder","columnSizeIndex","parts","columns","map","size","body","repeat","join","left","right","drawBorderTop","topBody","topJoin","topLeft","topRight","drawBorderJoin","joinBody","joinJoin","joinLeft","joinRight","drawBorderBottom","bottomBody","bottomJoin","bottomLeft","bottomRight"],"mappings":";;;;;;;AAAA;;;;;;;;AAQA;;;;;AAKA,MAAMA,UAAU,GAAG,CAACC,eAAD,EAAkBC,KAAlB,KAA4B;AAC7C,QAAMC,OAAO,GAAGF,eAAe,CAC5BG,GADa,CACRC,IAAD,IAAU;AACb,WAAOH,KAAK,CAACI,IAAN,CAAWC,MAAX,CAAkBF,IAAlB,CAAP;AACD,GAHa,EAIbG,IAJa,CAIRN,KAAK,CAACM,IAJE,CAAhB;AAMA,SAAON,KAAK,CAACO,IAAN,GAAaN,OAAb,GAAuBD,KAAK,CAACQ,KAA7B,GAAqC,IAA5C;AACD,CARD;AAUA;;;;;;;;AAQA;;;;;;;;;AAKA,MAAMC,aAAa,GAAG,CAACV,eAAD,EAAkBC,KAAlB,KAA4B;AAChD,SAAOF,UAAU,CAACC,eAAD,EAAkB;AACjCK,IAAAA,IAAI,EAAEJ,KAAK,CAACU,OADqB;AAEjCJ,IAAAA,IAAI,EAAEN,KAAK,CAACW,OAFqB;AAGjCJ,IAAAA,IAAI,EAAEP,KAAK,CAACY,OAHqB;AAIjCJ,IAAAA,KAAK,EAAER,KAAK,CAACa;AAJoB,GAAlB,CAAjB;AAMD,CAPD;AASA;;;;;;;;AAQA;;;;;;;;;AAKA,MAAMC,cAAc,GAAG,CAACf,eAAD,EAAkBC,KAAlB,KAA4B;AACjD,SAAOF,UAAU,CAACC,eAAD,EAAkB;AACjCK,IAAAA,IAAI,EAAEJ,KAAK,CAACe,QADqB;AAEjCT,IAAAA,IAAI,EAAEN,KAAK,CAACgB,QAFqB;AAGjCT,IAAAA,IAAI,EAAEP,KAAK,CAACiB,QAHqB;AAIjCT,IAAAA,KAAK,EAAER,KAAK,CAACkB;AAJoB,GAAlB,CAAjB;AAMD,CAPD;AASA;;;;;;;;AAQA;;;;;;;;;AAKA,MAAMC,gBAAgB,GAAG,CAACpB,eAAD,EAAkBC,KAAlB,KAA4B;AACnD,SAAOF,UAAU,CAACC,eAAD,EAAkB;AACjCK,IAAAA,IAAI,EAAEJ,KAAK,CAACoB,UADqB;AAEjCd,IAAAA,IAAI,EAAEN,KAAK,CAACqB,UAFqB;AAGjCd,IAAAA,IAAI,EAAEP,KAAK,CAACsB,UAHqB;AAIjCd,IAAAA,KAAK,EAAER,KAAK,CAACuB;AAJoB,GAAlB,CAAjB;AAMD,CAPD","sourcesContent":["/**\n * @typedef drawBorder~parts\n * @property {string} left\n * @property {string} right\n * @property {string} body\n * @property {string} join\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorder~parts} parts\n * @returns {string}\n */\nconst drawBorder = (columnSizeIndex, parts) => {\n const columns = columnSizeIndex\n .map((size) => {\n return parts.body.repeat(size);\n })\n .join(parts.join);\n\n return parts.left + columns + parts.right + '\\n';\n};\n\n/**\n * @typedef drawBorderTop~parts\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} topBody\n * @property {string} topJoin\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorderTop~parts} parts\n * @returns {string}\n */\nconst drawBorderTop = (columnSizeIndex, parts) => {\n return drawBorder(columnSizeIndex, {\n body: parts.topBody,\n join: parts.topJoin,\n left: parts.topLeft,\n right: parts.topRight\n });\n};\n\n/**\n * @typedef drawBorderJoin~parts\n * @property {string} joinLeft\n * @property {string} joinRight\n * @property {string} joinBody\n * @property {string} joinJoin\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorderJoin~parts} parts\n * @returns {string}\n */\nconst drawBorderJoin = (columnSizeIndex, parts) => {\n return drawBorder(columnSizeIndex, {\n body: parts.joinBody,\n join: parts.joinJoin,\n left: parts.joinLeft,\n right: parts.joinRight\n });\n};\n\n/**\n * @typedef drawBorderBottom~parts\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} topBody\n * @property {string} topJoin\n */\n\n/**\n * @param {number[]} columnSizeIndex\n * @param {drawBorderBottom~parts} parts\n * @returns {string}\n */\nconst drawBorderBottom = (columnSizeIndex, parts) => {\n return drawBorder(columnSizeIndex, {\n body: parts.bottomBody,\n join: parts.bottomJoin,\n left: parts.bottomLeft,\n right: parts.bottomRight\n });\n};\n\nexport {\n drawBorder,\n drawBorderBottom,\n drawBorderJoin,\n drawBorderTop\n};\n"],"file":"drawBorder.js"}
|
11
tools/node_modules/eslint/node_modules/table/dist/drawRow.js
generated
vendored
11
tools/node_modules/eslint/node_modules/table/dist/drawRow.js
generated
vendored
@ -1,8 +1,9 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/**
|
||||
* @typedef {Object} drawRow~border
|
||||
@ -16,6 +17,10 @@ Object.defineProperty(exports, "__esModule", {
|
||||
* @param {drawRow~border} border
|
||||
* @returns {string}
|
||||
*/
|
||||
exports.default = (columns, border) => {
|
||||
const drawRow = (columns, border) => {
|
||||
return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\n';
|
||||
};
|
||||
};
|
||||
|
||||
var _default = drawRow;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=drawRow.js.map
|
15
tools/node_modules/eslint/node_modules/table/dist/drawRow.js.flow
generated
vendored
Normal file
15
tools/node_modules/eslint/node_modules/table/dist/drawRow.js.flow
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
/**
|
||||
* @typedef {Object} drawRow~border
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {number[]} columns
|
||||
* @param {drawRow~border} border
|
||||
* @returns {string}
|
||||
*/
|
||||
export default (columns, border) => {
|
||||
return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\n';
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/drawRow.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/drawRow.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/drawRow.js"],"names":["columns","border","bodyLeft","join","bodyJoin","bodyRight"],"mappings":";;;;;;;AAAA;;;;;;;AAOA;;;;;iBAKgBA,O,EAASC,M,KAAW;AAClC,SAAOA,MAAM,CAACC,QAAP,GAAkBF,OAAO,CAACG,IAAR,CAAaF,MAAM,CAACG,QAApB,CAAlB,GAAkDH,MAAM,CAACI,SAAzD,GAAqE,IAA5E;AACD,C","sourcesContent":["/**\n * @typedef {Object} drawRow~border\n * @property {string} bodyLeft\n * @property {string} bodyRight\n * @property {string} bodyJoin\n */\n\n/**\n * @param {number[]} columns\n * @param {drawRow~border} border\n * @returns {string}\n */\nexport default (columns, border) => {\n return border.bodyLeft + columns.join(border.bodyJoin) + border.bodyRight + '\\n';\n};\n"],"file":"drawRow.js"}
|
23
tools/node_modules/eslint/node_modules/table/dist/drawTable.js
generated
vendored
23
tools/node_modules/eslint/node_modules/table/dist/drawTable.js
generated
vendored
@ -1,14 +1,13 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _drawBorder = require('./drawBorder');
|
||||
var _drawBorder = require("./drawBorder");
|
||||
|
||||
var _drawRow = require('./drawRow');
|
||||
|
||||
var _drawRow2 = _interopRequireDefault(_drawRow);
|
||||
var _drawRow = _interopRequireDefault(require("./drawRow"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -20,15 +19,12 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
* @param {Function} drawHorizontalLine
|
||||
* @returns {string}
|
||||
*/
|
||||
exports.default = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => {
|
||||
const drawTable = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => {
|
||||
let output;
|
||||
let realRowIndex;
|
||||
let rowHeight;
|
||||
|
||||
const rowCount = rows.length;
|
||||
|
||||
realRowIndex = 0;
|
||||
|
||||
output = '';
|
||||
|
||||
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
@ -36,11 +32,10 @@ exports.default = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLi
|
||||
}
|
||||
|
||||
rows.forEach((row, index0) => {
|
||||
output += (0, _drawRow2.default)(row, border);
|
||||
output += (0, _drawRow.default)(row, border);
|
||||
|
||||
if (!rowHeight) {
|
||||
rowHeight = rowSpanIndex[realRowIndex];
|
||||
|
||||
realRowIndex++;
|
||||
}
|
||||
|
||||
@ -56,4 +51,8 @@ exports.default = (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLi
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
||||
};
|
||||
|
||||
var _default = drawTable;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=drawTable.js.map
|
52
tools/node_modules/eslint/node_modules/table/dist/drawTable.js.flow
generated
vendored
Normal file
52
tools/node_modules/eslint/node_modules/table/dist/drawTable.js.flow
generated
vendored
Normal file
@ -0,0 +1,52 @@
|
||||
import {
|
||||
drawBorderTop,
|
||||
drawBorderJoin,
|
||||
drawBorderBottom
|
||||
} from './drawBorder';
|
||||
import drawRow from './drawRow';
|
||||
|
||||
/**
|
||||
* @param {Array} rows
|
||||
* @param {Object} border
|
||||
* @param {Array} columnSizeIndex
|
||||
* @param {Array} rowSpanIndex
|
||||
* @param {Function} drawHorizontalLine
|
||||
* @returns {string}
|
||||
*/
|
||||
export default (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => {
|
||||
let output;
|
||||
let realRowIndex;
|
||||
let rowHeight;
|
||||
|
||||
const rowCount = rows.length;
|
||||
|
||||
realRowIndex = 0;
|
||||
|
||||
output = '';
|
||||
|
||||
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
output += drawBorderTop(columnSizeIndex, border);
|
||||
}
|
||||
|
||||
rows.forEach((row, index0) => {
|
||||
output += drawRow(row, border);
|
||||
|
||||
if (!rowHeight) {
|
||||
rowHeight = rowSpanIndex[realRowIndex];
|
||||
|
||||
realRowIndex++;
|
||||
}
|
||||
|
||||
rowHeight--;
|
||||
|
||||
if (rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
output += drawBorderJoin(columnSizeIndex, border);
|
||||
}
|
||||
});
|
||||
|
||||
if (drawHorizontalLine(realRowIndex, rowCount)) {
|
||||
output += drawBorderBottom(columnSizeIndex, border);
|
||||
}
|
||||
|
||||
return output;
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/drawTable.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/drawTable.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/drawTable.js"],"names":["rows","border","columnSizeIndex","rowSpanIndex","drawHorizontalLine","output","realRowIndex","rowHeight","rowCount","length","forEach","row","index0"],"mappings":";;;;;;;AAAA;;AAKA;;;;AAEA;;;;;;;;mBAQgBA,I,EAAMC,M,EAAQC,e,EAAiBC,Y,EAAcC,kB,KAAuB;AAClF,MAAIC,MAAJ;AACA,MAAIC,YAAJ;AACA,MAAIC,SAAJ;AAEA,QAAMC,QAAQ,GAAGR,IAAI,CAACS,MAAtB;AAEAH,EAAAA,YAAY,GAAG,CAAf;AAEAD,EAAAA,MAAM,GAAG,EAAT;;AAEA,MAAID,kBAAkB,CAACE,YAAD,EAAeE,QAAf,CAAtB,EAAgD;AAC9CH,IAAAA,MAAM,IAAI,+BAAcH,eAAd,EAA+BD,MAA/B,CAAV;AACD;;AAEDD,EAAAA,IAAI,CAACU,OAAL,CAAa,CAACC,GAAD,EAAMC,MAAN,KAAiB;AAC5BP,IAAAA,MAAM,IAAI,sBAAQM,GAAR,EAAaV,MAAb,CAAV;;AAEA,QAAI,CAACM,SAAL,EAAgB;AACdA,MAAAA,SAAS,GAAGJ,YAAY,CAACG,YAAD,CAAxB;AAEAA,MAAAA,YAAY;AACb;;AAEDC,IAAAA,SAAS;;AAET,QAAIA,SAAS,KAAK,CAAd,IAAmBK,MAAM,KAAKJ,QAAQ,GAAG,CAAzC,IAA8CJ,kBAAkB,CAACE,YAAD,EAAeE,QAAf,CAApE,EAA8F;AAC5FH,MAAAA,MAAM,IAAI,gCAAeH,eAAf,EAAgCD,MAAhC,CAAV;AACD;AACF,GAdD;;AAgBA,MAAIG,kBAAkB,CAACE,YAAD,EAAeE,QAAf,CAAtB,EAAgD;AAC9CH,IAAAA,MAAM,IAAI,kCAAiBH,eAAjB,EAAkCD,MAAlC,CAAV;AACD;;AAED,SAAOI,MAAP;AACD,C","sourcesContent":["import {\n drawBorderTop,\n drawBorderJoin,\n drawBorderBottom\n} from './drawBorder';\nimport drawRow from './drawRow';\n\n/**\n * @param {Array} rows\n * @param {Object} border\n * @param {Array} columnSizeIndex\n * @param {Array} rowSpanIndex\n * @param {Function} drawHorizontalLine\n * @returns {string}\n */\nexport default (rows, border, columnSizeIndex, rowSpanIndex, drawHorizontalLine) => {\n let output;\n let realRowIndex;\n let rowHeight;\n\n const rowCount = rows.length;\n\n realRowIndex = 0;\n\n output = '';\n\n if (drawHorizontalLine(realRowIndex, rowCount)) {\n output += drawBorderTop(columnSizeIndex, border);\n }\n\n rows.forEach((row, index0) => {\n output += drawRow(row, border);\n\n if (!rowHeight) {\n rowHeight = rowSpanIndex[realRowIndex];\n\n realRowIndex++;\n }\n\n rowHeight--;\n\n if (rowHeight === 0 && index0 !== rowCount - 1 && drawHorizontalLine(realRowIndex, rowCount)) {\n output += drawBorderJoin(columnSizeIndex, border);\n }\n });\n\n if (drawHorizontalLine(realRowIndex, rowCount)) {\n output += drawBorderBottom(columnSizeIndex, border);\n }\n\n return output;\n};\n"],"file":"drawTable.js"}
|
23
tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js
generated
vendored
23
tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js
generated
vendored
@ -1,8 +1,9 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
@ -29,23 +30,20 @@ Object.defineProperty(exports, "__esModule", {
|
||||
* @param {string} name
|
||||
* @returns {border}
|
||||
*/
|
||||
exports.default = name => {
|
||||
const getBorderCharacters = name => {
|
||||
if (name === 'honeywell') {
|
||||
return {
|
||||
topBody: '═',
|
||||
topJoin: '╤',
|
||||
topLeft: '╔',
|
||||
topRight: '╗',
|
||||
|
||||
bottomBody: '═',
|
||||
bottomJoin: '╧',
|
||||
bottomLeft: '╚',
|
||||
bottomRight: '╝',
|
||||
|
||||
bodyLeft: '║',
|
||||
bodyRight: '║',
|
||||
bodyJoin: '│',
|
||||
|
||||
joinBody: '─',
|
||||
joinLeft: '╟',
|
||||
joinRight: '╢',
|
||||
@ -59,16 +57,13 @@ exports.default = name => {
|
||||
topJoin: '┬',
|
||||
topLeft: '┌',
|
||||
topRight: '┐',
|
||||
|
||||
bottomBody: '─',
|
||||
bottomJoin: '┴',
|
||||
bottomLeft: '└',
|
||||
bottomRight: '┘',
|
||||
|
||||
bodyLeft: '│',
|
||||
bodyRight: '│',
|
||||
bodyJoin: '│',
|
||||
|
||||
joinBody: '─',
|
||||
joinLeft: '├',
|
||||
joinRight: '┤',
|
||||
@ -82,16 +77,13 @@ exports.default = name => {
|
||||
topJoin: '+',
|
||||
topLeft: '+',
|
||||
topRight: '+',
|
||||
|
||||
bottomBody: '-',
|
||||
bottomJoin: '+',
|
||||
bottomLeft: '+',
|
||||
bottomRight: '+',
|
||||
|
||||
bodyLeft: '|',
|
||||
bodyRight: '|',
|
||||
bodyJoin: '|',
|
||||
|
||||
joinBody: '-',
|
||||
joinLeft: '|',
|
||||
joinRight: '|',
|
||||
@ -105,16 +97,13 @@ exports.default = name => {
|
||||
topJoin: '',
|
||||
topLeft: '',
|
||||
topRight: '',
|
||||
|
||||
bottomBody: '',
|
||||
bottomJoin: '',
|
||||
bottomLeft: '',
|
||||
bottomRight: '',
|
||||
|
||||
bodyLeft: '',
|
||||
bodyRight: '',
|
||||
bodyJoin: '',
|
||||
|
||||
joinBody: '',
|
||||
joinLeft: '',
|
||||
joinRight: '',
|
||||
@ -123,4 +112,8 @@ exports.default = name => {
|
||||
}
|
||||
|
||||
throw new Error('Unknown border template "' + name + '".');
|
||||
};
|
||||
};
|
||||
|
||||
var _default = getBorderCharacters;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=getBorderCharacters.js.map
|
120
tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js.flow
generated
vendored
Normal file
120
tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js.flow
generated
vendored
Normal file
@ -0,0 +1,120 @@
|
||||
/* eslint-disable sort-keys */
|
||||
|
||||
/**
|
||||
* @typedef border
|
||||
* @property {string} topBody
|
||||
* @property {string} topJoin
|
||||
* @property {string} topLeft
|
||||
* @property {string} topRight
|
||||
* @property {string} bottomBody
|
||||
* @property {string} bottomJoin
|
||||
* @property {string} bottomLeft
|
||||
* @property {string} bottomRight
|
||||
* @property {string} bodyLeft
|
||||
* @property {string} bodyRight
|
||||
* @property {string} bodyJoin
|
||||
* @property {string} joinBody
|
||||
* @property {string} joinLeft
|
||||
* @property {string} joinRight
|
||||
* @property {string} joinJoin
|
||||
*/
|
||||
|
||||
/**
|
||||
* @param {string} name
|
||||
* @returns {border}
|
||||
*/
|
||||
export default (name) => {
|
||||
if (name === 'honeywell') {
|
||||
return {
|
||||
topBody: '═',
|
||||
topJoin: '╤',
|
||||
topLeft: '╔',
|
||||
topRight: '╗',
|
||||
|
||||
bottomBody: '═',
|
||||
bottomJoin: '╧',
|
||||
bottomLeft: '╚',
|
||||
bottomRight: '╝',
|
||||
|
||||
bodyLeft: '║',
|
||||
bodyRight: '║',
|
||||
bodyJoin: '│',
|
||||
|
||||
joinBody: '─',
|
||||
joinLeft: '╟',
|
||||
joinRight: '╢',
|
||||
joinJoin: '┼'
|
||||
};
|
||||
}
|
||||
|
||||
if (name === 'norc') {
|
||||
return {
|
||||
topBody: '─',
|
||||
topJoin: '┬',
|
||||
topLeft: '┌',
|
||||
topRight: '┐',
|
||||
|
||||
bottomBody: '─',
|
||||
bottomJoin: '┴',
|
||||
bottomLeft: '└',
|
||||
bottomRight: '┘',
|
||||
|
||||
bodyLeft: '│',
|
||||
bodyRight: '│',
|
||||
bodyJoin: '│',
|
||||
|
||||
joinBody: '─',
|
||||
joinLeft: '├',
|
||||
joinRight: '┤',
|
||||
joinJoin: '┼'
|
||||
};
|
||||
}
|
||||
|
||||
if (name === 'ramac') {
|
||||
return {
|
||||
topBody: '-',
|
||||
topJoin: '+',
|
||||
topLeft: '+',
|
||||
topRight: '+',
|
||||
|
||||
bottomBody: '-',
|
||||
bottomJoin: '+',
|
||||
bottomLeft: '+',
|
||||
bottomRight: '+',
|
||||
|
||||
bodyLeft: '|',
|
||||
bodyRight: '|',
|
||||
bodyJoin: '|',
|
||||
|
||||
joinBody: '-',
|
||||
joinLeft: '|',
|
||||
joinRight: '|',
|
||||
joinJoin: '|'
|
||||
};
|
||||
}
|
||||
|
||||
if (name === 'void') {
|
||||
return {
|
||||
topBody: '',
|
||||
topJoin: '',
|
||||
topLeft: '',
|
||||
topRight: '',
|
||||
|
||||
bottomBody: '',
|
||||
bottomJoin: '',
|
||||
bottomLeft: '',
|
||||
bottomRight: '',
|
||||
|
||||
bodyLeft: '',
|
||||
bodyRight: '',
|
||||
bodyJoin: '',
|
||||
|
||||
joinBody: '',
|
||||
joinLeft: '',
|
||||
joinRight: '',
|
||||
joinJoin: ''
|
||||
};
|
||||
}
|
||||
|
||||
throw new Error('Unknown border template "' + name + '".');
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/getBorderCharacters.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/getBorderCharacters.js"],"names":["name","topBody","topJoin","topLeft","topRight","bottomBody","bottomJoin","bottomLeft","bottomRight","bodyLeft","bodyRight","bodyJoin","joinBody","joinLeft","joinRight","joinJoin","Error"],"mappings":";;;;;;;AAAA;;AAEA;;;;;;;;;;;;;;;;;;;AAmBA;;;;4BAIgBA,I,IAAS;AACvB,MAAIA,IAAI,KAAK,WAAb,EAA0B;AACxB,WAAO;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,OAAO,EAAE,GAFJ;AAGLC,MAAAA,OAAO,EAAE,GAHJ;AAILC,MAAAA,QAAQ,EAAE,GAJL;AAMLC,MAAAA,UAAU,EAAE,GANP;AAOLC,MAAAA,UAAU,EAAE,GAPP;AAQLC,MAAAA,UAAU,EAAE,GARP;AASLC,MAAAA,WAAW,EAAE,GATR;AAWLC,MAAAA,QAAQ,EAAE,GAXL;AAYLC,MAAAA,SAAS,EAAE,GAZN;AAaLC,MAAAA,QAAQ,EAAE,GAbL;AAeLC,MAAAA,QAAQ,EAAE,GAfL;AAgBLC,MAAAA,QAAQ,EAAE,GAhBL;AAiBLC,MAAAA,SAAS,EAAE,GAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,MAAIf,IAAI,KAAK,MAAb,EAAqB;AACnB,WAAO;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,OAAO,EAAE,GAFJ;AAGLC,MAAAA,OAAO,EAAE,GAHJ;AAILC,MAAAA,QAAQ,EAAE,GAJL;AAMLC,MAAAA,UAAU,EAAE,GANP;AAOLC,MAAAA,UAAU,EAAE,GAPP;AAQLC,MAAAA,UAAU,EAAE,GARP;AASLC,MAAAA,WAAW,EAAE,GATR;AAWLC,MAAAA,QAAQ,EAAE,GAXL;AAYLC,MAAAA,SAAS,EAAE,GAZN;AAaLC,MAAAA,QAAQ,EAAE,GAbL;AAeLC,MAAAA,QAAQ,EAAE,GAfL;AAgBLC,MAAAA,QAAQ,EAAE,GAhBL;AAiBLC,MAAAA,SAAS,EAAE,GAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,MAAIf,IAAI,KAAK,OAAb,EAAsB;AACpB,WAAO;AACLC,MAAAA,OAAO,EAAE,GADJ;AAELC,MAAAA,OAAO,EAAE,GAFJ;AAGLC,MAAAA,OAAO,EAAE,GAHJ;AAILC,MAAAA,QAAQ,EAAE,GAJL;AAMLC,MAAAA,UAAU,EAAE,GANP;AAOLC,MAAAA,UAAU,EAAE,GAPP;AAQLC,MAAAA,UAAU,EAAE,GARP;AASLC,MAAAA,WAAW,EAAE,GATR;AAWLC,MAAAA,QAAQ,EAAE,GAXL;AAYLC,MAAAA,SAAS,EAAE,GAZN;AAaLC,MAAAA,QAAQ,EAAE,GAbL;AAeLC,MAAAA,QAAQ,EAAE,GAfL;AAgBLC,MAAAA,QAAQ,EAAE,GAhBL;AAiBLC,MAAAA,SAAS,EAAE,GAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,MAAIf,IAAI,KAAK,MAAb,EAAqB;AACnB,WAAO;AACLC,MAAAA,OAAO,EAAE,EADJ;AAELC,MAAAA,OAAO,EAAE,EAFJ;AAGLC,MAAAA,OAAO,EAAE,EAHJ;AAILC,MAAAA,QAAQ,EAAE,EAJL;AAMLC,MAAAA,UAAU,EAAE,EANP;AAOLC,MAAAA,UAAU,EAAE,EAPP;AAQLC,MAAAA,UAAU,EAAE,EARP;AASLC,MAAAA,WAAW,EAAE,EATR;AAWLC,MAAAA,QAAQ,EAAE,EAXL;AAYLC,MAAAA,SAAS,EAAE,EAZN;AAaLC,MAAAA,QAAQ,EAAE,EAbL;AAeLC,MAAAA,QAAQ,EAAE,EAfL;AAgBLC,MAAAA,QAAQ,EAAE,EAhBL;AAiBLC,MAAAA,SAAS,EAAE,EAjBN;AAkBLC,MAAAA,QAAQ,EAAE;AAlBL,KAAP;AAoBD;;AAED,QAAM,IAAIC,KAAJ,CAAU,8BAA8BhB,IAA9B,GAAqC,IAA/C,CAAN;AACD,C","sourcesContent":["/* eslint-disable sort-keys */\n\n/**\n * @typedef border\n * @property {string} topBody\n * @property {string} topJoin\n * @property {string} topLeft\n * @property {string} topRight\n * @property {string} bottomBody\n * @property {string} bottomJoin\n * @property {string} bottomLeft\n * @property {string} bottomRight\n * @property {string} bodyLeft\n * @property {string} bodyRight\n * @property {string} bodyJoin\n * @property {string} joinBody\n * @property {string} joinLeft\n * @property {string} joinRight\n * @property {string} joinJoin\n */\n\n/**\n * @param {string} name\n * @returns {border}\n */\nexport default (name) => {\n if (name === 'honeywell') {\n return {\n topBody: '═',\n topJoin: '╤',\n topLeft: '╔',\n topRight: '╗',\n\n bottomBody: '═',\n bottomJoin: '╧',\n bottomLeft: '╚',\n bottomRight: '╝',\n\n bodyLeft: '║',\n bodyRight: '║',\n bodyJoin: '│',\n\n joinBody: '─',\n joinLeft: '╟',\n joinRight: '╢',\n joinJoin: '┼'\n };\n }\n\n if (name === 'norc') {\n return {\n topBody: '─',\n topJoin: '┬',\n topLeft: '┌',\n topRight: '┐',\n\n bottomBody: '─',\n bottomJoin: '┴',\n bottomLeft: '└',\n bottomRight: '┘',\n\n bodyLeft: '│',\n bodyRight: '│',\n bodyJoin: '│',\n\n joinBody: '─',\n joinLeft: '├',\n joinRight: '┤',\n joinJoin: '┼'\n };\n }\n\n if (name === 'ramac') {\n return {\n topBody: '-',\n topJoin: '+',\n topLeft: '+',\n topRight: '+',\n\n bottomBody: '-',\n bottomJoin: '+',\n bottomLeft: '+',\n bottomRight: '+',\n\n bodyLeft: '|',\n bodyRight: '|',\n bodyJoin: '|',\n\n joinBody: '-',\n joinLeft: '|',\n joinRight: '|',\n joinJoin: '|'\n };\n }\n\n if (name === 'void') {\n return {\n topBody: '',\n topJoin: '',\n topLeft: '',\n topRight: '',\n\n bottomBody: '',\n bottomJoin: '',\n bottomLeft: '',\n bottomRight: '',\n\n bodyLeft: '',\n bodyRight: '',\n bodyJoin: '',\n\n joinBody: '',\n joinLeft: '',\n joinRight: '',\n joinJoin: ''\n };\n }\n\n throw new Error('Unknown border template \"' + name + '\".');\n};\n"],"file":"getBorderCharacters.js"}
|
38
tools/node_modules/eslint/node_modules/table/dist/index.js
generated
vendored
38
tools/node_modules/eslint/node_modules/table/dist/index.js
generated
vendored
@ -1,24 +1,32 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.getBorderCharacters = exports.createStream = exports.table = undefined;
|
||||
Object.defineProperty(exports, "table", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _table.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "createStream", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _createStream.default;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "getBorderCharacters", {
|
||||
enumerable: true,
|
||||
get: function get() {
|
||||
return _getBorderCharacters.default;
|
||||
}
|
||||
});
|
||||
|
||||
var _table = require('./table');
|
||||
var _table = _interopRequireDefault(require("./table"));
|
||||
|
||||
var _table2 = _interopRequireDefault(_table);
|
||||
var _createStream = _interopRequireDefault(require("./createStream"));
|
||||
|
||||
var _createStream = require('./createStream');
|
||||
|
||||
var _createStream2 = _interopRequireDefault(_createStream);
|
||||
|
||||
var _getBorderCharacters = require('./getBorderCharacters');
|
||||
|
||||
var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters);
|
||||
var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
exports.table = _table2.default;
|
||||
exports.createStream = _createStream2.default;
|
||||
exports.getBorderCharacters = _getBorderCharacters2.default;
|
||||
//# sourceMappingURL=index.js.map
|
9
tools/node_modules/eslint/node_modules/table/dist/index.js.flow
generated
vendored
Normal file
9
tools/node_modules/eslint/node_modules/table/dist/index.js.flow
generated
vendored
Normal file
@ -0,0 +1,9 @@
|
||||
import table from './table';
|
||||
import createStream from './createStream';
|
||||
import getBorderCharacters from './getBorderCharacters';
|
||||
|
||||
export {
|
||||
table,
|
||||
createStream,
|
||||
getBorderCharacters
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/index.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/index.js"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;AAAA;;AACA;;AACA","sourcesContent":["import table from './table';\nimport createStream from './createStream';\nimport getBorderCharacters from './getBorderCharacters';\n\nexport {\n table,\n createStream,\n getBorderCharacters\n};\n"],"file":"index.js"}
|
51
tools/node_modules/eslint/node_modules/table/dist/makeConfig.js
generated
vendored
51
tools/node_modules/eslint/node_modules/table/dist/makeConfig.js
generated
vendored
@ -1,24 +1,17 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _lodash = require('lodash');
|
||||
var _lodash = _interopRequireDefault(require("lodash"));
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters"));
|
||||
|
||||
var _getBorderCharacters = require('./getBorderCharacters');
|
||||
var _validateConfig = _interopRequireDefault(require("./validateConfig"));
|
||||
|
||||
var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters);
|
||||
|
||||
var _validateConfig = require('./validateConfig');
|
||||
|
||||
var _validateConfig2 = _interopRequireDefault(_validateConfig);
|
||||
|
||||
var _calculateMaximumColumnWidthIndex = require('./calculateMaximumColumnWidthIndex');
|
||||
|
||||
var _calculateMaximumColumnWidthIndex2 = _interopRequireDefault(_calculateMaximumColumnWidthIndex);
|
||||
var _calculateMaximumColumnWidthIndex = _interopRequireDefault(require("./calculateMaximumColumnWidthIndex"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -28,12 +21,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
* @param {Object} border
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeBorder = function makeBorder() {
|
||||
let border = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
return Object.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border);
|
||||
const makeBorder = (border = {}) => {
|
||||
return Object.assign({}, (0, _getBorderCharacters.default)('honeywell'), border);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a configuration for every column using default
|
||||
* values for the missing configuration properties.
|
||||
@ -43,14 +33,13 @@ const makeBorder = function makeBorder() {
|
||||
* @param {Object} columnDefault
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeColumns = function makeColumns(rows) {
|
||||
let columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
let columnDefault = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
|
||||
const maximumColumnWidthIndex = (0, _calculateMaximumColumnWidthIndex2.default)(rows);
|
||||
|
||||
_lodash2.default.times(rows[0].length, index => {
|
||||
if (_lodash2.default.isUndefined(columns[index])) {
|
||||
const makeColumns = (rows, columns = {}, columnDefault = {}) => {
|
||||
const maximumColumnWidthIndex = (0, _calculateMaximumColumnWidthIndex.default)(rows);
|
||||
|
||||
_lodash.default.times(rows[0].length, index => {
|
||||
if (_lodash.default.isUndefined(columns[index])) {
|
||||
columns[index] = {};
|
||||
}
|
||||
|
||||
@ -66,7 +55,6 @@ const makeColumns = function makeColumns(rows) {
|
||||
|
||||
return columns;
|
||||
};
|
||||
|
||||
/**
|
||||
* Makes a new configuration object out of the userConfig object
|
||||
* using default values for the missing configuration properties.
|
||||
@ -76,12 +64,11 @@ const makeColumns = function makeColumns(rows) {
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
||||
exports.default = function (rows) {
|
||||
let userConfig = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
|
||||
(0, _validateConfig2.default)('config.json', userConfig);
|
||||
const makeConfig = (rows, userConfig = {}) => {
|
||||
(0, _validateConfig.default)('config.json', userConfig);
|
||||
|
||||
const config = _lodash2.default.cloneDeep(userConfig);
|
||||
const config = _lodash.default.cloneDeep(userConfig);
|
||||
|
||||
config.border = makeBorder(config.border);
|
||||
config.columns = makeColumns(rows, config.columns, config.columnDefault);
|
||||
@ -96,4 +83,8 @@ exports.default = function (rows) {
|
||||
}
|
||||
|
||||
return config;
|
||||
};
|
||||
};
|
||||
|
||||
var _default = makeConfig;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=makeConfig.js.map
|
72
tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.flow
generated
vendored
Normal file
72
tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.flow
generated
vendored
Normal file
@ -0,0 +1,72 @@
|
||||
import _ from 'lodash';
|
||||
import getBorderCharacters from './getBorderCharacters';
|
||||
import validateConfig from './validateConfig';
|
||||
import calculateMaximumColumnWidthIndex from './calculateMaximumColumnWidthIndex';
|
||||
|
||||
/**
|
||||
* Merges user provided border characters with the default border ("honeywell") characters.
|
||||
*
|
||||
* @param {Object} border
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeBorder = (border = {}) => {
|
||||
return Object.assign({}, getBorderCharacters('honeywell'), border);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a configuration for every column using default
|
||||
* values for the missing configuration properties.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @param {Object} columns
|
||||
* @param {Object} columnDefault
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeColumns = (rows, columns = {}, columnDefault = {}) => {
|
||||
const maximumColumnWidthIndex = calculateMaximumColumnWidthIndex(rows);
|
||||
|
||||
_.times(rows[0].length, (index) => {
|
||||
if (_.isUndefined(columns[index])) {
|
||||
columns[index] = {};
|
||||
}
|
||||
|
||||
columns[index] = Object.assign({
|
||||
alignment: 'left',
|
||||
paddingLeft: 1,
|
||||
paddingRight: 1,
|
||||
truncate: Infinity,
|
||||
width: maximumColumnWidthIndex[index],
|
||||
wrapWord: false
|
||||
}, columnDefault, columns[index]);
|
||||
});
|
||||
|
||||
return columns;
|
||||
};
|
||||
|
||||
/**
|
||||
* Makes a new configuration object out of the userConfig object
|
||||
* using default values for the missing configuration properties.
|
||||
*
|
||||
* @param {Array[]} rows
|
||||
* @param {Object} userConfig
|
||||
* @returns {Object}
|
||||
*/
|
||||
export default (rows, userConfig = {}) => {
|
||||
validateConfig('config.json', userConfig);
|
||||
|
||||
const config = _.cloneDeep(userConfig);
|
||||
|
||||
config.border = makeBorder(config.border);
|
||||
config.columns = makeColumns(rows, config.columns, config.columnDefault);
|
||||
|
||||
if (!config.drawHorizontalLine) {
|
||||
/**
|
||||
* @returns {boolean}
|
||||
*/
|
||||
config.drawHorizontalLine = () => {
|
||||
return true;
|
||||
};
|
||||
}
|
||||
|
||||
return config;
|
||||
};
|
1
tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.map
generated
vendored
Normal file
1
tools/node_modules/eslint/node_modules/table/dist/makeConfig.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"sources":["../src/makeConfig.js"],"names":["makeBorder","border","Object","assign","makeColumns","rows","columns","columnDefault","maximumColumnWidthIndex","_","times","length","index","isUndefined","alignment","paddingLeft","paddingRight","truncate","Infinity","width","wrapWord","userConfig","config","cloneDeep","drawHorizontalLine"],"mappings":";;;;;;;AAAA;;AACA;;AACA;;AACA;;;;AAEA;;;;;;AAMA,MAAMA,UAAU,GAAG,CAACC,MAAM,GAAG,EAAV,KAAiB;AAClC,SAAOC,MAAM,CAACC,MAAP,CAAc,EAAd,EAAkB,kCAAoB,WAApB,CAAlB,EAAoDF,MAApD,CAAP;AACD,CAFD;AAIA;;;;;;;;;;;AASA,MAAMG,WAAW,GAAG,CAACC,IAAD,EAAOC,OAAO,GAAG,EAAjB,EAAqBC,aAAa,GAAG,EAArC,KAA4C;AAC9D,QAAMC,uBAAuB,GAAG,+CAAiCH,IAAjC,CAAhC;;AAEAI,kBAAEC,KAAF,CAAQL,IAAI,CAAC,CAAD,CAAJ,CAAQM,MAAhB,EAAyBC,KAAD,IAAW;AACjC,QAAIH,gBAAEI,WAAF,CAAcP,OAAO,CAACM,KAAD,CAArB,CAAJ,EAAmC;AACjCN,MAAAA,OAAO,CAACM,KAAD,CAAP,GAAiB,EAAjB;AACD;;AAEDN,IAAAA,OAAO,CAACM,KAAD,CAAP,GAAiBV,MAAM,CAACC,MAAP,CAAc;AAC7BW,MAAAA,SAAS,EAAE,MADkB;AAE7BC,MAAAA,WAAW,EAAE,CAFgB;AAG7BC,MAAAA,YAAY,EAAE,CAHe;AAI7BC,MAAAA,QAAQ,EAAEC,QAJmB;AAK7BC,MAAAA,KAAK,EAAEX,uBAAuB,CAACI,KAAD,CALD;AAM7BQ,MAAAA,QAAQ,EAAE;AANmB,KAAd,EAOdb,aAPc,EAOCD,OAAO,CAACM,KAAD,CAPR,CAAjB;AAQD,GAbD;;AAeA,SAAON,OAAP;AACD,CAnBD;AAqBA;;;;;;;;;;oBAQgBD,I,EAAMgB,UAAU,GAAG,E,KAAO;AACxC,+BAAe,aAAf,EAA8BA,UAA9B;;AAEA,QAAMC,MAAM,GAAGb,gBAAEc,SAAF,CAAYF,UAAZ,CAAf;;AAEAC,EAAAA,MAAM,CAACrB,MAAP,GAAgBD,UAAU,CAACsB,MAAM,CAACrB,MAAR,CAA1B;AACAqB,EAAAA,MAAM,CAAChB,OAAP,GAAiBF,WAAW,CAACC,IAAD,EAAOiB,MAAM,CAAChB,OAAd,EAAuBgB,MAAM,CAACf,aAA9B,CAA5B;;AAEA,MAAI,CAACe,MAAM,CAACE,kBAAZ,EAAgC;AAC9B;;;AAGAF,IAAAA,MAAM,CAACE,kBAAP,GAA4B,MAAM;AAChC,aAAO,IAAP;AACD,KAFD;AAGD;;AAED,SAAOF,MAAP;AACD,C","sourcesContent":["import _ from 'lodash';\nimport getBorderCharacters from './getBorderCharacters';\nimport validateConfig from './validateConfig';\nimport calculateMaximumColumnWidthIndex from './calculateMaximumColumnWidthIndex';\n\n/**\n * Merges user provided border characters with the default border (\"honeywell\") characters.\n *\n * @param {Object} border\n * @returns {Object}\n */\nconst makeBorder = (border = {}) => {\n return Object.assign({}, getBorderCharacters('honeywell'), border);\n};\n\n/**\n * Creates a configuration for every column using default\n * values for the missing configuration properties.\n *\n * @param {Array[]} rows\n * @param {Object} columns\n * @param {Object} columnDefault\n * @returns {Object}\n */\nconst makeColumns = (rows, columns = {}, columnDefault = {}) => {\n const maximumColumnWidthIndex = calculateMaximumColumnWidthIndex(rows);\n\n _.times(rows[0].length, (index) => {\n if (_.isUndefined(columns[index])) {\n columns[index] = {};\n }\n\n columns[index] = Object.assign({\n alignment: 'left',\n paddingLeft: 1,\n paddingRight: 1,\n truncate: Infinity,\n width: maximumColumnWidthIndex[index],\n wrapWord: false\n }, columnDefault, columns[index]);\n });\n\n return columns;\n};\n\n/**\n * Makes a new configuration object out of the userConfig object\n * using default values for the missing configuration properties.\n *\n * @param {Array[]} rows\n * @param {Object} userConfig\n * @returns {Object}\n */\nexport default (rows, userConfig = {}) => {\n validateConfig('config.json', userConfig);\n\n const config = _.cloneDeep(userConfig);\n\n config.border = makeBorder(config.border);\n config.columns = makeColumns(rows, config.columns, config.columnDefault);\n\n if (!config.drawHorizontalLine) {\n /**\n * @returns {boolean}\n */\n config.drawHorizontalLine = () => {\n return true;\n };\n }\n\n return config;\n};\n"],"file":"makeConfig.js"}
|
46
tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js
generated
vendored
46
tools/node_modules/eslint/node_modules/table/dist/makeStreamConfig.js
generated
vendored
@ -1,20 +1,15 @@
|
||||
'use strict';
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = void 0;
|
||||
|
||||
var _lodash = require('lodash');
|
||||
var _lodash = _interopRequireDefault(require("lodash"));
|
||||
|
||||
var _lodash2 = _interopRequireDefault(_lodash);
|
||||
var _getBorderCharacters = _interopRequireDefault(require("./getBorderCharacters"));
|
||||
|
||||
var _getBorderCharacters = require('./getBorderCharacters');
|
||||
|
||||
var _getBorderCharacters2 = _interopRequireDefault(_getBorderCharacters);
|
||||
|
||||
var _validateConfig = require('./validateConfig');
|
||||
|
||||
var _validateConfig2 = _interopRequireDefault(_validateConfig);
|
||||
var _validateConfig = _interopRequireDefault(require("./validateConfig"));
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
@ -24,12 +19,9 @@ function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { de
|
||||
* @param {Object} border
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeBorder = function makeBorder() {
|
||||
let border = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
return Object.assign({}, (0, _getBorderCharacters2.default)('honeywell'), border);
|
||||
const makeBorder = (border = {}) => {
|
||||
return Object.assign({}, (0, _getBorderCharacters.default)('honeywell'), border);
|
||||
};
|
||||
|
||||
/**
|
||||
* Creates a configuration for every column using default
|
||||
* values for the missing configuration properties.
|
||||
@ -39,12 +31,11 @@ const makeBorder = function makeBorder() {
|
||||
* @param {Object} columnDefault
|
||||
* @returns {Object}
|
||||
*/
|
||||
const makeColumns = function makeColumns(columnCount) {
|
||||
let columns = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : {};
|
||||
let columnDefault = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : {};
|
||||
|
||||
_lodash2.default.times(columnCount, index => {
|
||||
if (_lodash2.default.isUndefined(columns[index])) {
|
||||
|
||||
const makeColumns = (columnCount, columns = {}, columnDefault = {}) => {
|
||||
_lodash.default.times(columnCount, index => {
|
||||
if (_lodash.default.isUndefined(columns[index])) {
|
||||
columns[index] = {};
|
||||
}
|
||||
|
||||
@ -59,7 +50,6 @@ const makeColumns = function makeColumns(columnCount) {
|
||||
|
||||
return columns;
|
||||
};
|
||||
|
||||
/**
|
||||
* @typedef {Object} columnConfig
|
||||
* @property {string} alignment
|
||||
@ -85,12 +75,11 @@ const makeColumns = function makeColumns(columnCount) {
|
||||
* @returns {Object}
|
||||
*/
|
||||
|
||||
exports.default = function () {
|
||||
let userConfig = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : {};
|
||||
|
||||
(0, _validateConfig2.default)('streamConfig.json', userConfig);
|
||||
const makeStreamConfig = (userConfig = {}) => {
|
||||
(0, _validateConfig.default)('streamConfig.json', userConfig);
|
||||
|
||||
const config = _lodash2.default.cloneDeep(userConfig);
|
||||
const config = _lodash.default.cloneDeep(userConfig);
|
||||
|
||||
if (!config.columnDefault || !config.columnDefault.width) {
|
||||
throw new Error('Must provide config.columnDefault.width when creating a stream.');
|
||||
@ -102,6 +91,9 @@ exports.default = function () {
|
||||
|
||||
config.border = makeBorder(config.border);
|
||||
config.columns = makeColumns(config.columnCount, config.columns, config.columnDefault);
|
||||
|
||||
return config;
|
||||
};
|
||||
};
|
||||
|
||||
var _default = makeStreamConfig;
|
||||
exports.default = _default;
|
||||
//# sourceMappingURL=makeStreamConfig.js.map
|
Some files were not shown because too many files have changed in this diff Show More
Loading…
x
Reference in New Issue
Block a user