Add node modules and compiled JavaScript from main
This commit is contained in:
parent
8bccaeaf7c
commit
4181bfdf50
7465 changed files with 1775003 additions and 2 deletions
45
node_modules/@babel/helper-validator-option/lib/find-suggestion.js
generated
vendored
Normal file
45
node_modules/@babel/helper-validator-option/lib/find-suggestion.js
generated
vendored
Normal file
|
@ -0,0 +1,45 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.findSuggestion = findSuggestion;
|
||||
const {
|
||||
min
|
||||
} = Math;
|
||||
|
||||
function levenshtein(a, b) {
|
||||
let t = [],
|
||||
u = [],
|
||||
i,
|
||||
j;
|
||||
const m = a.length,
|
||||
n = b.length;
|
||||
|
||||
if (!m) {
|
||||
return n;
|
||||
}
|
||||
|
||||
if (!n) {
|
||||
return m;
|
||||
}
|
||||
|
||||
for (j = 0; j <= n; j++) {
|
||||
t[j] = j;
|
||||
}
|
||||
|
||||
for (i = 1; i <= m; i++) {
|
||||
for (u = [i], j = 1; j <= n; j++) {
|
||||
u[j] = a[i - 1] === b[j - 1] ? t[j - 1] : min(t[j - 1], t[j], u[j - 1]) + 1;
|
||||
}
|
||||
|
||||
t = u;
|
||||
}
|
||||
|
||||
return u[n];
|
||||
}
|
||||
|
||||
function findSuggestion(str, arr) {
|
||||
const distances = arr.map(el => levenshtein(el, str));
|
||||
return arr[distances.indexOf(min(...distances))];
|
||||
}
|
21
node_modules/@babel/helper-validator-option/lib/index.js
generated
vendored
Normal file
21
node_modules/@babel/helper-validator-option/lib/index.js
generated
vendored
Normal file
|
@ -0,0 +1,21 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
Object.defineProperty(exports, "OptionValidator", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _validator.OptionValidator;
|
||||
}
|
||||
});
|
||||
Object.defineProperty(exports, "findSuggestion", {
|
||||
enumerable: true,
|
||||
get: function () {
|
||||
return _findSuggestion.findSuggestion;
|
||||
}
|
||||
});
|
||||
|
||||
var _validator = require("./validator");
|
||||
|
||||
var _findSuggestion = require("./find-suggestion");
|
58
node_modules/@babel/helper-validator-option/lib/validator.js
generated
vendored
Normal file
58
node_modules/@babel/helper-validator-option/lib/validator.js
generated
vendored
Normal file
|
@ -0,0 +1,58 @@
|
|||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.OptionValidator = void 0;
|
||||
|
||||
var _findSuggestion = require("./find-suggestion");
|
||||
|
||||
class OptionValidator {
|
||||
constructor(descriptor) {
|
||||
this.descriptor = descriptor;
|
||||
}
|
||||
|
||||
validateTopLevelOptions(options, TopLevelOptionShape) {
|
||||
const validOptionNames = Object.keys(TopLevelOptionShape);
|
||||
|
||||
for (const option of Object.keys(options)) {
|
||||
if (!validOptionNames.includes(option)) {
|
||||
throw new Error(this.formatMessage(`'${option}' is not a valid top-level option.
|
||||
- Did you mean '${(0, _findSuggestion.findSuggestion)(option, validOptionNames)}'?`));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
validateBooleanOption(name, value, defaultValue) {
|
||||
if (value === undefined) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
this.invariant(typeof value === "boolean", `'${name}' option must be a boolean.`);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
validateStringOption(name, value, defaultValue) {
|
||||
if (value === undefined) {
|
||||
return defaultValue;
|
||||
} else {
|
||||
this.invariant(typeof value === "string", `'${name}' option must be a string.`);
|
||||
}
|
||||
|
||||
return value;
|
||||
}
|
||||
|
||||
invariant(condition, message) {
|
||||
if (!condition) {
|
||||
throw new Error(this.formatMessage(message));
|
||||
}
|
||||
}
|
||||
|
||||
formatMessage(message) {
|
||||
return `${this.descriptor}: ${message}`;
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
exports.OptionValidator = OptionValidator;
|
Loading…
Add table
Add a link
Reference in a new issue