mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
tools: update ESLint to 5.11.0
Update ESLint to 5.11.0. PR-URL: https://github.com/nodejs/node/pull/25191 Reviewed-By: Rich Trott <rtrott@gmail.com> Reviewed-By: Trivikram Kamat <trivikr.dev@gmail.com> Reviewed-By: Ruben Bridgewater <ruben@bridgewater.de>
This commit is contained in:
1 parent
6557ea180c
commit
8ab0a48928
18 files changed
+280
-64
No files matched your search
+1
@@ -207,6 +207,7 @@ module.exports = {
|
||||
"no-unused-vars": "error",
|
||||
"no-use-before-define": "off",
|
||||
"no-useless-call": "off",
|
||||
"no-useless-catch": "off",
|
||||
"no-useless-computed-key": "off",
|
||||
"no-useless-concat": "off",
|
||||
"no-useless-constructor": "off",
|
||||
|
||||
+14
-5
@@ -100,14 +100,20 @@ module.exports = {
|
||||
* @private
|
||||
*/
|
||||
function isInsideObjectPattern(node) {
|
||||
let { parent } = node;
|
||||
let current = node;
|
||||
|
||||
while (parent) {
|
||||
if (parent.type === "ObjectPattern") {
|
||||
while (current) {
|
||||
const parent = current.parent;
|
||||
|
||||
if (parent && parent.type === "Property" && parent.computed && parent.key === current) {
|
||||
return false;
|
||||
}
|
||||
|
||||
if (current.type === "ObjectPattern") {
|
||||
return true;
|
||||
}
|
||||
|
||||
parent = parent.parent;
|
||||
current = parent;
|
||||
}
|
||||
|
||||
return false;
|
||||
@@ -169,12 +175,15 @@ module.exports = {
|
||||
|
||||
if (node.parent.parent && node.parent.parent.type === "ObjectPattern") {
|
||||
if (node.parent.shorthand && node.parent.value.left && nameIsUnderscored) {
|
||||
|
||||
report(node);
|
||||
}
|
||||
|
||||
const assignmentKeyEqualsValue = node.parent.key.name === node.parent.value.name;
|
||||
|
||||
if (isUnderscored(name) && node.parent.computed) {
|
||||
report(node);
|
||||
}
|
||||
|
||||
// prevent checking righthand side of destructured object
|
||||
if (node.parent.key === node && node.parent.value !== node) {
|
||||
return;
|
||||
|
||||
+143
-1
@@ -4,6 +4,12 @@
|
||||
*/
|
||||
"use strict";
|
||||
|
||||
const {
|
||||
isArrowToken,
|
||||
isParenthesised,
|
||||
isOpeningParenToken
|
||||
} = require("../util/ast-utils");
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
@@ -41,6 +47,142 @@ module.exports = {
|
||||
return context.options[0] || "beside";
|
||||
}
|
||||
|
||||
/**
|
||||
* Formats the comments depending on whether it's a line or block comment.
|
||||
* @param {Comment[]} comments The array of comments between the arrow and body
|
||||
* @param {Integer} column The column number of the first token
|
||||
* @returns {string} A string of comment text joined by line breaks
|
||||
*/
|
||||
function formatComments(comments, column) {
|
||||
const whiteSpaces = " ".repeat(column);
|
||||
|
||||
return `${comments.map(comment => {
|
||||
|
||||
if (comment.type === "Line") {
|
||||
return `//${comment.value}`;
|
||||
}
|
||||
|
||||
return `/*${comment.value}*/`;
|
||||
}).join(`\n${whiteSpaces}`)}\n${whiteSpaces}`;
|
||||
}
|
||||
|
||||
/**
|
||||
* Finds the first token to prepend comments to depending on the parent type
|
||||
* @param {Node} node The validated node
|
||||
* @returns {Token|Node} The node to prepend comments to
|
||||
*/
|
||||
function findFirstToken(node) {
|
||||
switch (node.parent.type) {
|
||||
case "VariableDeclarator":
|
||||
|
||||
// If the parent is first or only declarator, return the declaration, else, declarator
|
||||
return sourceCode.getFirstToken(
|
||||
node.parent.parent.declarations.length === 1 ||
|
||||
node.parent.parent.declarations[0].id.name === node.parent.id.name
|
||||
? node.parent.parent : node.parent
|
||||
);
|
||||
case "CallExpression":
|
||||
case "Property":
|
||||
|
||||
// find the object key
|
||||
return sourceCode.getFirstToken(node.parent);
|
||||
default:
|
||||
return node;
|
||||
}
|
||||
}
|
||||
|
||||
/**
|
||||
* Helper function for adding parentheses fixes for nodes containing nested arrow functions
|
||||
* @param {Fixer} fixer Fixer
|
||||
* @param {Token} arrow - The arrow token
|
||||
* @param {ASTNode} arrowBody - The arrow function body
|
||||
* @returns {Function[]} autofixer -- wraps function bodies with parentheses
|
||||
*/
|
||||
function addParentheses(fixer, arrow, arrowBody) {
|
||||
const parenthesesFixes = [];
|
||||
let closingParentheses = "";
|
||||
|
||||
let followingBody = arrowBody;
|
||||
let currentArrow = arrow;
|
||||
|
||||
while (currentArrow) {
|
||||
if (!isParenthesised(sourceCode, followingBody)) {
|
||||
parenthesesFixes.push(
|
||||
fixer.insertTextAfter(currentArrow, " (")
|
||||
);
|
||||
|
||||
const paramsToken = sourceCode.getTokenBefore(currentArrow, token =>
|
||||
isOpeningParenToken(token) || token.type === "Identifier");
|
||||
|
||||
const whiteSpaces = " ".repeat(paramsToken.loc.start.column);
|
||||
|
||||
closingParentheses = `\n${whiteSpaces})${closingParentheses}`;
|
||||
}
|
||||
|
||||
currentArrow = sourceCode.getTokenAfter(currentArrow, isArrowToken);
|
||||
|
||||
if (currentArrow) {
|
||||
followingBody = sourceCode.getTokenAfter(currentArrow, token => !isOpeningParenToken(token));
|
||||
}
|
||||
}
|
||||
|
||||
return [...parenthesesFixes,
|
||||
fixer.insertTextAfter(arrowBody, closingParentheses)
|
||||
];
|
||||
}
|
||||
|
||||
/**
|
||||
* Autofixes the function body to collapse onto the same line as the arrow.
|
||||
* If comments exist, prepends the comments before the arrow function.
|
||||
* If the function body contains arrow functions, appends the function bodies with parentheses.
|
||||
* @param {Token} arrowToken The arrow token.
|
||||
* @param {ASTNode} arrowBody the function body
|
||||
* @param {ASTNode} node The evaluated node
|
||||
* @returns {Function} autofixer -- validates the node to adhere to besides
|
||||
*/
|
||||
function autoFixBesides(arrowToken, arrowBody, node) {
|
||||
return fixer => {
|
||||
const placeBesides = fixer.replaceTextRange([arrowToken.range[1], arrowBody.range[0]], " ");
|
||||
|
||||
const comments = sourceCode.getCommentsInside(node).filter(comment =>
|
||||
comment.loc.start.line < arrowBody.loc.start.line);
|
||||
|
||||
if (comments.length) {
|
||||
|
||||
// If the grandparent is not a variable declarator
|
||||
if (
|
||||
arrowBody.parent &&
|
||||
arrowBody.parent.parent &&
|
||||
arrowBody.parent.parent.type !== "VariableDeclarator"
|
||||
) {
|
||||
|
||||
// If any arrow functions follow, return the necessary parens fixes.
|
||||
if (sourceCode.getTokenAfter(arrowToken, isArrowToken) && arrowBody.parent.parent.type !== "VariableDeclarator") {
|
||||
return addParentheses(fixer, arrowToken, arrowBody);
|
||||
}
|
||||
|
||||
// If any arrow functions precede, the necessary fixes have already been returned, so return null.
|
||||
if (sourceCode.getTokenBefore(arrowToken, isArrowToken) && arrowBody.parent.parent.type !== "VariableDeclarator") {
|
||||
return null;
|
||||
}
|
||||
}
|
||||
|
||||
const firstToken = findFirstToken(node);
|
||||
|
||||
const commentText = formatComments(comments, firstToken.loc.start.column);
|
||||
|
||||
const commentBeforeExpression = fixer.insertTextBeforeRange(
|
||||
firstToken.range,
|
||||
commentText
|
||||
);
|
||||
|
||||
return [placeBesides, commentBeforeExpression];
|
||||
}
|
||||
|
||||
return placeBesides;
|
||||
};
|
||||
}
|
||||
|
||||
/**
|
||||
* Validates the location of an arrow function body
|
||||
* @param {ASTNode} node The arrow function body
|
||||
@@ -75,7 +217,7 @@ module.exports = {
|
||||
context.report({
|
||||
node: fixerTarget,
|
||||
message: "Expected no linebreak before this expression.",
|
||||
fix: fixer => fixer.replaceTextRange([tokenBefore.range[1], fixerTarget.range[0]], " ")
|
||||
fix: autoFixBesides(tokenBefore, fixerTarget, node)
|
||||
});
|
||||
}
|
||||
}
|
||||
|
||||
+24
-22
@@ -522,25 +522,13 @@ module.exports = {
|
||||
},
|
||||
VariableDeclarator: {
|
||||
oneOf: [
|
||||
{
|
||||
type: "integer",
|
||||
minimum: 0
|
||||
},
|
||||
ELEMENT_LIST_SCHEMA,
|
||||
{
|
||||
type: "object",
|
||||
properties: {
|
||||
var: {
|
||||
type: "integer",
|
||||
minimum: 0
|
||||
},
|
||||
let: {
|
||||
type: "integer",
|
||||
minimum: 0
|
||||
},
|
||||
const: {
|
||||
type: "integer",
|
||||
minimum: 0
|
||||
}
|
||||
var: ELEMENT_LIST_SCHEMA,
|
||||
let: ELEMENT_LIST_SCHEMA,
|
||||
const: ELEMENT_LIST_SCHEMA
|
||||
},
|
||||
additionalProperties: false
|
||||
}
|
||||
@@ -661,7 +649,7 @@ module.exports = {
|
||||
if (context.options[1]) {
|
||||
lodash.merge(options, context.options[1]);
|
||||
|
||||
if (typeof options.VariableDeclarator === "number") {
|
||||
if (typeof options.VariableDeclarator === "number" || options.VariableDeclarator === "first") {
|
||||
options.VariableDeclarator = {
|
||||
var: options.VariableDeclarator,
|
||||
let: options.VariableDeclarator,
|
||||
@@ -1349,10 +1337,27 @@ module.exports = {
|
||||
},
|
||||
|
||||
VariableDeclaration(node) {
|
||||
const variableIndent = Object.prototype.hasOwnProperty.call(options.VariableDeclarator, node.kind)
|
||||
let variableIndent = Object.prototype.hasOwnProperty.call(options.VariableDeclarator, node.kind)
|
||||
? options.VariableDeclarator[node.kind]
|
||||
: DEFAULT_VARIABLE_INDENT;
|
||||
|
||||
const firstToken = sourceCode.getFirstToken(node),
|
||||
lastToken = sourceCode.getLastToken(node);
|
||||
|
||||
if (options.VariableDeclarator[node.kind] === "first") {
|
||||
if (node.declarations.length > 1) {
|
||||
addElementListIndent(
|
||||
node.declarations,
|
||||
firstToken,
|
||||
lastToken,
|
||||
"first"
|
||||
);
|
||||
return;
|
||||
}
|
||||
|
||||
variableIndent = DEFAULT_VARIABLE_INDENT;
|
||||
}
|
||||
|
||||
if (node.declarations[node.declarations.length - 1].loc.start.line > node.loc.start.line) {
|
||||
|
||||
/*
|
||||
@@ -1374,13 +1379,10 @@ module.exports = {
|
||||
* on the same line as the start of the declaration, provided that there are declarators that
|
||||
* follow this one.
|
||||
*/
|
||||
const firstToken = sourceCode.getFirstToken(node);
|
||||
|
||||
offsets.setDesiredOffsets(node.range, firstToken, variableIndent, true);
|
||||
} else {
|
||||
offsets.setDesiredOffsets(node.range, sourceCode.getFirstToken(node), variableIndent);
|
||||
offsets.setDesiredOffsets(node.range, firstToken, variableIndent);
|
||||
}
|
||||
const lastToken = sourceCode.getLastToken(node);
|
||||
|
||||
if (astUtils.isSemicolonToken(lastToken)) {
|
||||
offsets.ignoreToken(lastToken);
|
||||
|
||||
+1
-1
@@ -30,7 +30,7 @@ module.exports = {
|
||||
type: "problem",
|
||||
|
||||
docs: {
|
||||
description: "disallow irregular whitespace outside of strings and comments",
|
||||
description: "disallow irregular whitespace",
|
||||
category: "Possible Errors",
|
||||
recommended: true,
|
||||
url: "https://eslint.org/docs/rules/no-irregular-whitespace"
|
||||
|
||||
+51
@@ -0,0 +1,51 @@
|
||||
/**
|
||||
* @fileoverview Reports useless `catch` clauses that just rethrow their error.
|
||||
* @author Teddy Katz
|
||||
*/
|
||||
|
||||
"use strict";
|
||||
|
||||
//------------------------------------------------------------------------------
|
||||
// Rule Definition
|
||||
//------------------------------------------------------------------------------
|
||||
|
||||
module.exports = {
|
||||
meta: {
|
||||
type: "suggestion",
|
||||
|
||||
docs: {
|
||||
description: "disallow unnecessary `catch` clauses",
|
||||
category: "Best Practices",
|
||||
recommended: false,
|
||||
url: "https://eslint.org/docs/rules/no-useless-catch"
|
||||
},
|
||||
|
||||
schema: []
|
||||
},
|
||||
|
||||
create(context) {
|
||||
return {
|
||||
CatchClause(node) {
|
||||
if (
|
||||
node.param.type === "Identifier" &&
|
||||
node.body.body.length &&
|
||||
node.body.body[0].type === "ThrowStatement" &&
|
||||
node.body.body[0].argument.type === "Identifier" &&
|
||||
node.body.body[0].argument.name === node.param.name
|
||||
) {
|
||||
if (node.parent.finalizer) {
|
||||
context.report({
|
||||
node,
|
||||
message: "Unnecessary catch clause."
|
||||
});
|
||||
} else {
|
||||
context.report({
|
||||
node: node.parent,
|
||||
message: "Unnecessary try/catch wrapper."
|
||||
});
|
||||
}
|
||||
}
|
||||
}
|
||||
};
|
||||
}
|
||||
};
|
||||
+1
-1
@@ -244,7 +244,7 @@ The following formats are supported for string validation with "format" keyword:
|
||||
- _uri_: full URI.
|
||||
- _uri-reference_: URI reference, including full and relative URIs.
|
||||
- _uri-template_: URI template according to [RFC6570](https://tools.ietf.org/html/rfc6570)
|
||||
- _url_: [URL record](https://url.spec.whatwg.org/#concept-url).
|
||||
- _url_ (deprecated): [URL record](https://url.spec.whatwg.org/#concept-url).
|
||||
- _email_: email address.
|
||||
- _hostname_: host name according to [RFC1034](http://tools.ietf.org/html/rfc1034#section-3.5).
|
||||
- _ipv4_: IP address v4.
|
||||
|
||||
+1
-9
@@ -6595,8 +6595,6 @@ function Ajv(opts) {
|
||||
this._refs = {};
|
||||
this._fragments = {};
|
||||
this._formats = formats(opts.format);
|
||||
var schemaUriFormat = this._schemaUriFormat = this._formats['uri-reference'];
|
||||
this._schemaUriFormatFunc = function (str) { return schemaUriFormat.test(str); };
|
||||
|
||||
this._cache = opts.cache || new Cache;
|
||||
this._loadingSchemas = {};
|
||||
@@ -6711,13 +6709,7 @@ function validateSchema(schema, throwOrLogError) {
|
||||
this.errors = null;
|
||||
return true;
|
||||
}
|
||||
var currentUriFormat = this._formats.uri;
|
||||
this._formats.uri = typeof currentUriFormat == 'function'
|
||||
? this._schemaUriFormatFunc
|
||||
: this._schemaUriFormat;
|
||||
var valid;
|
||||
try { valid = this.validate($schema, schema); }
|
||||
finally { this._formats.uri = currentUriFormat; }
|
||||
var valid = this.validate($schema, schema);
|
||||
if (!valid && throwOrLogError) {
|
||||
var message = 'schema is invalid: ' + this.errorsText();
|
||||
if (this._opts.validateSchema == 'log') this.logger.error(message);
|
||||
|
||||
+2
-2
@@ -1,3 +1,3 @@
|
||||
/* ajv 6.6.1: Another JSON Schema Validator */
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Ajv=e()}}(function(){return function o(i,n,l){function u(r,e){if(!n[r]){if(!i[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(c)return c(r,!0);var a=new Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}var s=n[r]={exports:{}};i[r][0].call(s.exports,function(e){return u(i[r][1][e]||e)},s,s.exports,o,i,n,l)}return n[r].exports}for(var c="function"==typeof require&&require,e=0;e<l.length;e++)u(l[e]);return u}({1:[function(e,r,t){"use strict";var a=r.exports=function(){this._cache={}};a.prototype.put=function(e,r){this._cache[e]=r},a.prototype.get=function(e){return this._cache[e]},a.prototype.del=function(e){delete this._cache[e]},a.prototype.clear=function(){this._cache={}}},{}],2:[function(e,r,t){"use strict";var s=e("./error_classes").MissingRef;r.exports=function t(r,i,a){var n=this;if("function"!=typeof this._opts.loadSchema)throw new Error("options.loadSchema should be a function");"function"==typeof i&&(a=i,i=void 0);var e=l(r).then(function(){var e=n._addSchema(r,void 0,i);return e.validate||function(o){try{return n._compile(o)}catch(e){if(e instanceof s)return function(e){var r=e.missingSchema;if(s(r))throw new Error("Schema "+r+" is loaded but "+e.missingRef+" cannot be resolved");var t=n._loadingSchemas[r];t||(t=n._loadingSchemas[r]=n._opts.loadSchema(r)).then(a,a);return t.then(function(e){if(!s(r))return l(e).then(function(){s(r)||n.addSchema(e,r,void 0,i)})}).then(function(){return u(o)});function a(){delete n._loadingSchemas[r]}function s(e){return n._refs[e]||n._schemas[e]}}(e);throw e}}(e)});a&&e.then(function(e){a(null,e)},a);return e;function l(e){var r=e.$schema;return r&&!n.getSchema(r)?t.call(n,{$ref:r},!0):Promise.resolve()}function u(o){try{return n._compile(o)}catch(e){if(e instanceof s)return function(e){var r=e.missingSchema;if(s(r))throw new Error("Schema "+r+" is loaded but "+e.missingRef+" cannot be resolved");var t=n._loadingSchemas[r];t||(t=n._loadingSchemas[r]=n._opts.loadSchema(r)).then(a,a);return t.then(function(e){if(!s(r))return l(e).then(function(){s(r)||n.addSchema(e,r,void 0,i)})}).then(function(){return u(o)});function a(){delete n._loadingSchemas[r]}function s(e){return n._refs[e]||n._schemas[e]}}(e);throw e}}}},{"./error_classes":3}],3:[function(e,r,t){"use strict";var a=e("./resolve");function s(e,r,t){this.message=t||s.message(e,r),this.missingRef=a.url(e,r),this.missingSchema=a.normalizeId(a.fullPath(this.missingRef))}function o(e){return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e}r.exports={Validation:o(function(e){this.message="validation failed",this.errors=e,this.ajv=this.validation=!0}),MissingRef:o(s)},s.message=function(e,r){return"can't resolve reference "+r+" from id "+e}},{"./resolve":6}],4:[function(e,r,t){"use strict";var a=e("./util"),o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31],n=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i,s=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i,l=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,u=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,c=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\uLine truncated
|
||||
/* ajv 6.6.2: Another JSON Schema Validator */
|
||||
!function(e){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=e();else if("function"==typeof define&&define.amd)define([],e);else{("undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this).Ajv=e()}}(function(){return function o(i,n,l){function u(r,e){if(!n[r]){if(!i[r]){var t="function"==typeof require&&require;if(!e&&t)return t(r,!0);if(c)return c(r,!0);var a=new Error("Cannot find module '"+r+"'");throw a.code="MODULE_NOT_FOUND",a}var s=n[r]={exports:{}};i[r][0].call(s.exports,function(e){return u(i[r][1][e]||e)},s,s.exports,o,i,n,l)}return n[r].exports}for(var c="function"==typeof require&&require,e=0;e<l.length;e++)u(l[e]);return u}({1:[function(e,r,t){"use strict";var a=r.exports=function(){this._cache={}};a.prototype.put=function(e,r){this._cache[e]=r},a.prototype.get=function(e){return this._cache[e]},a.prototype.del=function(e){delete this._cache[e]},a.prototype.clear=function(){this._cache={}}},{}],2:[function(e,r,t){"use strict";var s=e("./error_classes").MissingRef;r.exports=function t(r,i,a){var n=this;if("function"!=typeof this._opts.loadSchema)throw new Error("options.loadSchema should be a function");"function"==typeof i&&(a=i,i=void 0);var e=l(r).then(function(){var e=n._addSchema(r,void 0,i);return e.validate||function(o){try{return n._compile(o)}catch(e){if(e instanceof s)return function(e){var r=e.missingSchema;if(s(r))throw new Error("Schema "+r+" is loaded but "+e.missingRef+" cannot be resolved");var t=n._loadingSchemas[r];t||(t=n._loadingSchemas[r]=n._opts.loadSchema(r)).then(a,a);return t.then(function(e){if(!s(r))return l(e).then(function(){s(r)||n.addSchema(e,r,void 0,i)})}).then(function(){return u(o)});function a(){delete n._loadingSchemas[r]}function s(e){return n._refs[e]||n._schemas[e]}}(e);throw e}}(e)});a&&e.then(function(e){a(null,e)},a);return e;function l(e){var r=e.$schema;return r&&!n.getSchema(r)?t.call(n,{$ref:r},!0):Promise.resolve()}function u(o){try{return n._compile(o)}catch(e){if(e instanceof s)return function(e){var r=e.missingSchema;if(s(r))throw new Error("Schema "+r+" is loaded but "+e.missingRef+" cannot be resolved");var t=n._loadingSchemas[r];t||(t=n._loadingSchemas[r]=n._opts.loadSchema(r)).then(a,a);return t.then(function(e){if(!s(r))return l(e).then(function(){s(r)||n.addSchema(e,r,void 0,i)})}).then(function(){return u(o)});function a(){delete n._loadingSchemas[r]}function s(e){return n._refs[e]||n._schemas[e]}}(e);throw e}}}},{"./error_classes":3}],3:[function(e,r,t){"use strict";var a=e("./resolve");function s(e,r,t){this.message=t||s.message(e,r),this.missingRef=a.url(e,r),this.missingSchema=a.normalizeId(a.fullPath(this.missingRef))}function o(e){return e.prototype=Object.create(Error.prototype),e.prototype.constructor=e}r.exports={Validation:o(function(e){this.message="validation failed",this.errors=e,this.ajv=this.validation=!0}),MissingRef:o(s)},s.message=function(e,r){return"can't resolve reference "+r+" from id "+e}},{"./resolve":6}],4:[function(e,r,t){"use strict";var a=e("./util"),o=/^(\d\d\d\d)-(\d\d)-(\d\d)$/,i=[0,31,28,31,30,31,30,31,31,30,31,30,31],n=/^(\d\d):(\d\d):(\d\d)(\.\d+)?(z|[+-]\d\d:\d\d)?$/i,s=/^[a-z0-9](?:[a-z0-9-]{0,61}[a-z0-9])?(?:\.[a-z0-9](?:[-0-9a-z]{0,61}[0-9a-z])?)*$/i,l=/^(?:[a-z][a-z0-9+\-.]*:)(?:\/?\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:]|%[0-9a-f]{2})*@)?(?:\[(?:(?:(?:(?:[0-9a-f]{1,4}:){6}|::(?:[0-9a-f]{1,4}:){5}|(?:[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){4}|(?:(?:[0-9a-f]{1,4}:){0,1}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){3}|(?:(?:[0-9a-f]{1,4}:){0,2}[0-9a-f]{1,4})?::(?:[0-9a-f]{1,4}:){2}|(?:(?:[0-9a-f]{1,4}:){0,3}[0-9a-f]{1,4})?::[0-9a-f]{1,4}:|(?:(?:[0-9a-f]{1,4}:){0,4}[0-9a-f]{1,4})?::)(?:[0-9a-f]{1,4}:[0-9a-f]{1,4}|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?))|(?:(?:[0-9a-f]{1,4}:){0,5}[0-9a-f]{1,4})?::[0-9a-f]{1,4}|(?:(?:[0-9a-f]{1,4}:){0,6}[0-9a-f]{1,4})?::)|[Vv][0-9a-f]+\.[a-z0-9\-._~!$&'()*+,;=:]+)\]|(?:(?:25[0-5]|2[0-4]\d|[01]?\d\d?)\.){3}(?:25[0-5]|2[0-4]\d|[01]?\d\d?)|(?:[a-z0-9\-._~!$&'()*+,;=]|%[0-9a-f]{2})*)(?::\d*)?(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*|\/(?:(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)?|(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})+(?:\/(?:[a-z0-9\-._~!$&'()*+,;=:@]|%[0-9a-f]{2})*)*)(?:\?(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?(?:#(?:[a-z0-9\-._~!$&'()*+,;=:@/?]|%[0-9a-f]{2})*)?$/i,u=/^(?:(?:[^\x00-\x20"'<>%\\^`{|}]|%[0-9a-f]{2})|\{[+#./;?&=,!@|]?(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?(?:,(?:[a-z0-9_]|%[0-9a-f]{2})+(?::[1-9][0-9]{0,3}|\*)?)*\})*$/i,c=/^(?:(?:http[s\u017F]?|ftp):\/\/)(?:(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\u2060-\u2FFF\u3001-\uD7FF\uE000-\uFEFE\uFF00-\uFFFF]|[\uD800-\uDBFF][\uDC00-\uDFFF]|[\uD800-\uDBFF](?![\uDC00-\uDFFF])|(?:[^\uD800-\uDBFF]|^)[\uDC00-\uDFFF])+(?::(?:[\0-\x08\x0E-\x1F!-\x9F\xA1-\u167F\u1681-\u1FFF\u200B-\u2027\u202A-\u202E\u2030-\u205E\uLine truncated
|
||||
//# sourceMappingURL=ajv.min.js.map
|
||||
+1
-1
@@ -1 +1 @@
|
||||
{"version":3,"sources":["0"],"names":["f","exports","module","define","amd","window","global","self","this","Ajv","r","e","n","t","o","i","c","require","u","a","Error","code","p","call","length","1","Cache","_cache","prototype","put","key","value","get","del","clear","2","MissingRefError","MissingRef","compileAsync","schema","meta","callback","_opts","loadSchema","undefined","loadMetaSchemaOf","then","schemaObj","_addSchema","validate","_compile","ref","missingSchema","added","missingRef","schemaPromise","_loadingSchemas","removePromise","sch","addSchema","_compileAsync","_refs","_schemas","loadMissingSchema","v","$schema","getSchema","$ref","Promise","resolve","./error_classes","3","baseId","message","url","normalizeId","fullPath","errorSubclass","Subclass","Object","create","constructor","Validation","errors","ajv","validation","./resolve","4","util","DATE","DAYS","TIME","HOSTNAME","URI","URITEMPLATE","URL","UUID","JSON_POINTER","JSON_POINTER_URI_FRAGMENT","RELATIVE_JSON_POINTER","formats","mode","copy","date","str","matches","match","year","month","day","time","full","hour","minute","second","fast","date-time","uri","uri-reference","uri-template","email","hostname","ipv4","ipv6","regex","uuid","json-pointer","json-pointer-uri-fragment","relative-json-pointer","dateTime","split","DATE_TIME_SEPARATOR","NOT_URI_FRAGMENT","test","Z_ANCHOR","RegExp","./util","5","errorClasses","stableStringify","validateGenerator","ucs2length","equal","ValidationError","compIndex","root","_compilations","patternCode","patterns","toQuotedString","defaultCode","refValCode","refVal","customRuleCode","vars","arr","statement","compile","localRefs","opts","refs","patternsHash","defaults","defaultsHash","customRules","index","compiling","compilation","callValidate","result","apply","arguments","_formats","RULES","localCompile","cv","$async","sourceCode","source","splice","_schema","_root","isRoot","isTop","schemaPath","errSchemaPath","errorPath","resolveRef","usePattern","useDefault","useCustomRule","logger","processCode","makeValidate","Function","error","_refVal","refCode","refIndex","resolvedRef","rootRefId","addLocalRef","localSchema","inlineRef","inlineRefs","refId","inline","regexStr","valueStr","rule","parentSchema","it","validateSchema","definition","valid","errorsText","macro","keyword","../dotjs/validate","fast-deep-equal","fast-json-stable-stringify","6","SchemaObject","traverse","res","resolveSchema","parse","refPath","_getFullPath","getFullPath","_getId","keys","id","parsedRef","resolveUrl","getJsonPointer","ids","schemaId","baseIds","","fullPaths","allKeys","jsonPtr","rootSchema","parentJsonPtr","parentKeyword","keyIndex","escapeFragment","PREVENT_SCOPE_CHANGE","toHash","fragment","slice","parts","part","unescapeFragment","SIMPLE_INLINED","limit","checkNoRef","item","Array","isArray","countKeys","count","Infinity","normalize","serialize","TRAILING_SLASH_HASH","replace","./schema_obj","json-schema-traverse","uri-js","7","ruleModules","type","rules","maximum","minimum","properties","ALL","all","types","forEach","group","map","implKeywords","k","push","implements","$comment","keywords","concat","custom","../dotjs","8","obj","9","len","pos","charCodeAt","10","checkDataType","dataType","data","negate","EQUAL","AND","OK","NOT","to","checkDataTypes","dataTypes","array","object","null","number","integer","coerceToTypes","optionCoerceTypes","COERCE_TO_TYPES","getProperty","escapeQuotes","varOccurences","dataVar","varReplace","expr","cleanUpCode","out","EMPTY_ELSE","EMPTY_IF_NO_ELSE","EMPTY_IF_WITH_ELSE","finalCleanUpCode","async","ERRORS_REGEXP","REMOVE_ERRORS_ASYNC","RETURN_ASYNC","RETURN_DATA_ASYNC","REMOVE_ERRORS","RETURN_VALID","RETURN_TRUE","ROOTDATA_REGEXP","REMOVE_ROOTDATA","schemaHasRules","schemaHasRulesExcept","exceptKeyword","getPathExpr","currentPath","jsonPointers","isNumber","joinPaths","getPath","prop","path","escapeJsonPointer","getData","$data","lvl","paths","up","jsonPointer","segments","segment","unescapeJsonPointer","decodeURIComponent","encodeURIComponent","hash","IDENTIFIER","SINGLE_QUOTE","b","./ucs2length","11","KEYWORDS","metaSchema","keywordsJsonPointers","JSON","stringify","j","anyOf","12","$keyword","$ruleType","$schemaValue","$lvl","level","$dataLvl","dataLevel","$schemaPath","$errSchemaPath","$breakOnError","allErrors","$isData","dataPathArr","$isMax","$exclusiveKeyword","$schemaExcl","$isDataExcl","$op","$notOp","$errorKeyword","$schemaValueExcl","$exclusive","$exclType","$exclIsNumber","$opStr","$opExpr","$$outStack","createErrors","messages","verbose","__err","pop","compositeRule","Math","13","14","unicode","15","16","$it","$closingBraces","$nextValid","$currentBaseId","$allSchemasEmpty","arr1","$sch","$i","l1","17","$valid","$errs","every","$wasComposite","18","19","20","$idx","$dataNxt","$nextData","$nonEmptySchema","$passData","$code","21","$compile","$inline","$macro","$ruleValidate","$validateCode","$rule","$definition","$rDef","$validateSchema","$ruleErrs","$ruleErr","$asyncKeyword","statLine truncated
|
||||
{"version":3,"sources":["0"],"names":["f","exports","module","define","amd","window","global","self","this","Ajv","r","e","n","t","o","i","c","require","u","a","Error","code","p","call","length","1","Cache","_cache","prototype","put","key","value","get","del","clear","2","MissingRefError","MissingRef","compileAsync","schema","meta","callback","_opts","loadSchema","undefined","loadMetaSchemaOf","then","schemaObj","_addSchema","validate","_compile","ref","missingSchema","added","missingRef","schemaPromise","_loadingSchemas","removePromise","sch","addSchema","_compileAsync","_refs","_schemas","loadMissingSchema","v","$schema","getSchema","$ref","Promise","resolve","./error_classes","3","baseId","message","url","normalizeId","fullPath","errorSubclass","Subclass","Object","create","constructor","Validation","errors","ajv","validation","./resolve","4","util","DATE","DAYS","TIME","HOSTNAME","URI","URITEMPLATE","URL","UUID","JSON_POINTER","JSON_POINTER_URI_FRAGMENT","RELATIVE_JSON_POINTER","formats","mode","copy","date","str","matches","match","year","month","day","time","full","hour","minute","second","fast","date-time","uri","uri-reference","uri-template","email","hostname","ipv4","ipv6","regex","uuid","json-pointer","json-pointer-uri-fragment","relative-json-pointer","dateTime","split","DATE_TIME_SEPARATOR","NOT_URI_FRAGMENT","test","Z_ANCHOR","RegExp","./util","5","errorClasses","stableStringify","validateGenerator","ucs2length","equal","ValidationError","compIndex","root","_compilations","patternCode","patterns","toQuotedString","defaultCode","refValCode","refVal","customRuleCode","vars","arr","statement","compile","localRefs","opts","refs","patternsHash","defaults","defaultsHash","customRules","index","compiling","compilation","callValidate","result","apply","arguments","_formats","RULES","localCompile","cv","$async","sourceCode","source","splice","_schema","_root","isRoot","isTop","schemaPath","errSchemaPath","errorPath","resolveRef","usePattern","useDefault","useCustomRule","logger","processCode","makeValidate","Function","error","_refVal","refCode","refIndex","resolvedRef","rootRefId","addLocalRef","localSchema","inlineRef","inlineRefs","refId","inline","regexStr","valueStr","rule","parentSchema","it","validateSchema","definition","valid","errorsText","macro","keyword","../dotjs/validate","fast-deep-equal","fast-json-stable-stringify","6","SchemaObject","traverse","res","resolveSchema","parse","refPath","_getFullPath","getFullPath","_getId","keys","id","parsedRef","resolveUrl","getJsonPointer","ids","schemaId","baseIds","","fullPaths","allKeys","jsonPtr","rootSchema","parentJsonPtr","parentKeyword","keyIndex","escapeFragment","PREVENT_SCOPE_CHANGE","toHash","fragment","slice","parts","part","unescapeFragment","SIMPLE_INLINED","limit","checkNoRef","item","Array","isArray","countKeys","count","Infinity","normalize","serialize","TRAILING_SLASH_HASH","replace","./schema_obj","json-schema-traverse","uri-js","7","ruleModules","type","rules","maximum","minimum","properties","ALL","all","types","forEach","group","map","implKeywords","k","push","implements","$comment","keywords","concat","custom","../dotjs","8","obj","9","len","pos","charCodeAt","10","checkDataType","dataType","data","negate","EQUAL","AND","OK","NOT","to","checkDataTypes","dataTypes","array","object","null","number","integer","coerceToTypes","optionCoerceTypes","COERCE_TO_TYPES","getProperty","escapeQuotes","varOccurences","dataVar","varReplace","expr","cleanUpCode","out","EMPTY_ELSE","EMPTY_IF_NO_ELSE","EMPTY_IF_WITH_ELSE","finalCleanUpCode","async","ERRORS_REGEXP","REMOVE_ERRORS_ASYNC","RETURN_ASYNC","RETURN_DATA_ASYNC","REMOVE_ERRORS","RETURN_VALID","RETURN_TRUE","ROOTDATA_REGEXP","REMOVE_ROOTDATA","schemaHasRules","schemaHasRulesExcept","exceptKeyword","getPathExpr","currentPath","jsonPointers","isNumber","joinPaths","getPath","prop","path","escapeJsonPointer","getData","$data","lvl","paths","up","jsonPointer","segments","segment","unescapeJsonPointer","decodeURIComponent","encodeURIComponent","hash","IDENTIFIER","SINGLE_QUOTE","b","./ucs2length","11","KEYWORDS","metaSchema","keywordsJsonPointers","JSON","stringify","j","anyOf","12","$keyword","$ruleType","$schemaValue","$lvl","level","$dataLvl","dataLevel","$schemaPath","$errSchemaPath","$breakOnError","allErrors","$isData","dataPathArr","$isMax","$exclusiveKeyword","$schemaExcl","$isDataExcl","$op","$notOp","$errorKeyword","$schemaValueExcl","$exclusive","$exclType","$exclIsNumber","$opStr","$opExpr","$$outStack","createErrors","messages","verbose","__err","pop","compositeRule","Math","13","14","unicode","15","16","$it","$closingBraces","$nextValid","$currentBaseId","$allSchemasEmpty","arr1","$sch","$i","l1","17","$valid","$errs","every","$wasComposite","18","19","20","$idx","$dataNxt","$nextData","$nonEmptySchema","$passData","$code","21","$compile","$inline","$macro","$ruleValidate","$validateCode","$rule","$definition","$rDef","$validateSchema","$ruleErrs","$ruleErr","$asyncKeyword","statLine truncated
|
||||
+1
-9
@@ -55,8 +55,6 @@ function Ajv(opts) {
|
||||
this._refs = {};
|
||||
this._fragments = {};
|
||||
this._formats = formats(opts.format);
|
||||
var schemaUriFormat = this._schemaUriFormat = this._formats['uri-reference'];
|
||||
this._schemaUriFormatFunc = function (str) { return schemaUriFormat.test(str); };
|
||||
|
||||
this._cache = opts.cache || new Cache;
|
||||
this._loadingSchemas = {};
|
||||
@@ -171,13 +169,7 @@ function validateSchema(schema, throwOrLogError) {
|
||||
this.errors = null;
|
||||
return true;
|
||||
}
|
||||
var currentUriFormat = this._formats.uri;
|
||||
this._formats.uri = typeof currentUriFormat == 'function'
|
||||
? this._schemaUriFormatFunc
|
||||
: this._schemaUriFormat;
|
||||
var valid;
|
||||
try { valid = this.validate($schema, schema); }
|
||||
finally { this._formats.uri = currentUriFormat; }
|
||||
var valid = this.validate($schema, schema);
|
||||
if (!valid && throwOrLogError) {
|
||||
var message = 'schema is invalid: ' + this.errorsText();
|
||||
if (this._opts.validateSchema == 'log') this.logger.error(message);
|
||||
|
||||
+3
-4
@@ -28,12 +28,10 @@
|
||||
"type": "object",
|
||||
"properties": {
|
||||
"id": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
"type": "string"
|
||||
},
|
||||
"$schema": {
|
||||
"type": "string",
|
||||
"format": "uri"
|
||||
"type": "string"
|
||||
},
|
||||
"title": {
|
||||
"type": "string"
|
||||
@@ -137,6 +135,7 @@
|
||||
}
|
||||
]
|
||||
},
|
||||
"format": { "type": "string" },
|
||||
"allOf": { "$ref": "#/definitions/schemaArray" },
|
||||
"anyOf": { "$ref": "#/definitions/schemaArray" },
|
||||
"oneOf": { "$ref": "#/definitions/schemaArray" },
|
||||
|
||||
+2
-2
@@ -33,7 +33,7 @@
|
||||
"karma": "^3.0.0",
|
||||
"karma-chrome-launcher": "^2.2.0",
|
||||
"karma-mocha": "^1.1.1",
|
||||
"karma-sauce-launcher": "^1.1.0",
|
||||
"karma-sauce-launcher": "^2.0.0",
|
||||
"mocha": "^5.1.1",
|
||||
"nyc": "^12.0.1",
|
||||
"pre-commit": "^1.1.1",
|
||||
@@ -96,5 +96,5 @@
|
||||
},
|
||||
"tonicExampleFilename": ".tonic_example.js",
|
||||
"typings": "lib/ajv.d.ts",
|
||||
"version": "6.6.1"
|
||||
"version": "6.6.2"
|
||||
}
|
||||
+28
-2
@@ -1,5 +1,13 @@
|
||||
"use strict";
|
||||
|
||||
function _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }
|
||||
|
||||
function _nonIterableSpread() { throw new TypeError("Invalid attempt to spread non-iterable instance"); }
|
||||
|
||||
function _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === "[object Arguments]") return Array.from(iter); }
|
||||
|
||||
function _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }
|
||||
|
||||
function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterator === "symbol") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === "function" && obj.constructor === Symbol && obj !== Symbol.prototype ? "symbol" : typeof obj; }; } return _typeof(obj); }
|
||||
|
||||
(function (f) {
|
||||
@@ -594,7 +602,9 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
|
||||
}
|
||||
|
||||
function extend(namespace, delimiter) {
|
||||
return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
||||
var newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
||||
newDebug.log = this.log;
|
||||
return newDebug;
|
||||
}
|
||||
/**
|
||||
* Enables a debug mode by namespaces. This can include modes
|
||||
@@ -636,12 +646,17 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
|
||||
/**
|
||||
* Disable debug output.
|
||||
*
|
||||
* @return {String} namespaces
|
||||
* @api public
|
||||
*/
|
||||
|
||||
|
||||
function disable() {
|
||||
var namespaces = [].concat(_toConsumableArray(createDebug.names.map(toNamespace)), _toConsumableArray(createDebug.skips.map(toNamespace).map(function (namespace) {
|
||||
return '-' + namespace;
|
||||
}))).join(',');
|
||||
createDebug.enable('');
|
||||
return namespaces;
|
||||
}
|
||||
/**
|
||||
* Returns true if the given mode name is enabled, false otherwise.
|
||||
@@ -675,6 +690,18 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
|
||||
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`.
|
||||
*
|
||||
* @param {Mixed} val
|
||||
@@ -883,4 +910,3 @@ function _typeof(obj) { if (typeof Symbol === "function" && typeof Symbol.iterat
|
||||
}]
|
||||
}, {}, [4])(4);
|
||||
});
|
||||
|
||||
+2
-2
@@ -67,13 +67,13 @@
|
||||
"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:coverage": "cat ./coverage/lcov.info | coveralls",
|
||||
"test:node": "istanbul cover _mocha -- test.js"
|
||||
},
|
||||
"unpkg": "./dist/debug.js",
|
||||
"version": "4.1.0"
|
||||
"version": "4.1.1"
|
||||
}
|
||||
+3
-1
@@ -143,7 +143,9 @@ function setup(env) {
|
||||
}
|
||||
|
||||
function extend(namespace, delimiter) {
|
||||
return createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
||||
const newDebug = createDebug(this.namespace + (typeof delimiter === 'undefined' ? ':' : delimiter) + namespace);
|
||||
newDebug.log = this.log;
|
||||
return newDebug;
|
||||
}
|
||||
|
||||
/**
|
||||
|
||||
+1
-1
@@ -73,7 +73,7 @@
|
||||
"test-api": "node test",
|
||||
"test-coverage": "nyc --reporter lcov tape test.js"
|
||||
},
|
||||
"version": "1.0.2",
|
||||
"version": "1.1.1",
|
||||
"xo": {
|
||||
"prettier": true,
|
||||
"esnext": false,
|
||||
|
||||
+1
-1
@@ -134,5 +134,5 @@
|
||||
"publish-release": "node Makefile.js publishRelease",
|
||||
"test": "node Makefile.js test"
|
||||
},
|
||||
"version": "5.10.0"
|
||||
"version": "5.11.0"
|
||||
}
|
||||
Reference in new issue
Block a user