Commit 4e362378 authored by Rosanny Sihombing's avatar Rosanny Sihombing
Browse files

Merge branch 'MLAB-671' into 'testing'

Mlab 671

See merge request !158
parents 3d0c87b0 bde9ccfd
Pipeline #6646 passed with stage
in 11 seconds
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.
# @babel/helper-replace-supers
> Helper function to replace supers
See our website [@babel/helper-replace-supers](https://babeljs.io/docs/en/babel-helper-replace-supers) for more information.
## Install
Using npm:
```sh
npm install --save @babel/helper-replace-supers
```
or using yarn:
```sh
yarn add @babel/helper-replace-supers
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = void 0;
Object.defineProperty(exports, "environmentVisitor", {
enumerable: true,
get: function () {
return _helperEnvironmentVisitor.default;
}
});
Object.defineProperty(exports, "skipAllButComputedKey", {
enumerable: true,
get: function () {
return _helperEnvironmentVisitor.skipAllButComputedKey;
}
});
var _traverse = require("@babel/traverse");
var _helperMemberExpressionToFunctions = require("@babel/helper-member-expression-to-functions");
var _helperOptimiseCallExpression = require("@babel/helper-optimise-call-expression");
var _helperEnvironmentVisitor = require("@babel/helper-environment-visitor");
var _t = require("@babel/types");
const {
assignmentExpression,
booleanLiteral,
callExpression,
cloneNode,
identifier,
memberExpression,
sequenceExpression,
stringLiteral,
thisExpression
} = _t;
function getPrototypeOfExpression(objectRef, isStatic, file, isPrivateMethod) {
objectRef = cloneNode(objectRef);
const targetRef = isStatic || isPrivateMethod ? objectRef : memberExpression(objectRef, identifier("prototype"));
return callExpression(file.addHelper("getPrototypeOf"), [targetRef]);
}
const visitor = _traverse.default.visitors.merge([_helperEnvironmentVisitor.default, {
Super(path, state) {
const {
node,
parentPath
} = path;
if (!parentPath.isMemberExpression({
object: node
})) return;
state.handle(parentPath);
}
}]);
const unshadowSuperBindingVisitor = _traverse.default.visitors.merge([_helperEnvironmentVisitor.default, {
Scopable(path, {
refName
}) {
const binding = path.scope.getOwnBinding(refName);
if (binding && binding.identifier.name === refName) {
path.scope.rename(refName);
}
}
}]);
const specHandlers = {
memoise(superMember, count) {
const {
scope,
node
} = superMember;
const {
computed,
property
} = node;
if (!computed) {
return;
}
const memo = scope.maybeGenerateMemoised(property);
if (!memo) {
return;
}
this.memoiser.set(property, memo, count);
},
prop(superMember) {
const {
computed,
property
} = superMember.node;
if (this.memoiser.has(property)) {
return cloneNode(this.memoiser.get(property));
}
if (computed) {
return cloneNode(property);
}
return stringLiteral(property.name);
},
get(superMember) {
return this._get(superMember, this._getThisRefs());
},
_get(superMember, thisRefs) {
const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod);
return callExpression(this.file.addHelper("get"), [thisRefs.memo ? sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), thisRefs.this]);
},
_getThisRefs() {
if (!this.isDerivedConstructor) {
return {
this: thisExpression()
};
}
const thisRef = this.scope.generateDeclaredUidIdentifier("thisSuper");
return {
memo: assignmentExpression("=", thisRef, thisExpression()),
this: cloneNode(thisRef)
};
},
set(superMember, value) {
const thisRefs = this._getThisRefs();
const proto = getPrototypeOfExpression(this.getObjectRef(), this.isStatic, this.file, this.isPrivateMethod);
return callExpression(this.file.addHelper("set"), [thisRefs.memo ? sequenceExpression([thisRefs.memo, proto]) : proto, this.prop(superMember), value, thisRefs.this, booleanLiteral(superMember.isInStrictMode())]);
},
destructureSet(superMember) {
throw superMember.buildCodeFrameError(`Destructuring to a super field is not supported yet.`);
},
call(superMember, args) {
const thisRefs = this._getThisRefs();
return (0, _helperOptimiseCallExpression.default)(this._get(superMember, thisRefs), cloneNode(thisRefs.this), args, false);
},
optionalCall(superMember, args) {
const thisRefs = this._getThisRefs();
return (0, _helperOptimiseCallExpression.default)(this._get(superMember, thisRefs), cloneNode(thisRefs.this), args, true);
}
};
const looseHandlers = Object.assign({}, specHandlers, {
prop(superMember) {
const {
property
} = superMember.node;
if (this.memoiser.has(property)) {
return cloneNode(this.memoiser.get(property));
}
return cloneNode(property);
},
get(superMember) {
const {
isStatic,
getSuperRef
} = this;
const {
computed
} = superMember.node;
const prop = this.prop(superMember);
let object;
if (isStatic) {
var _getSuperRef;
object = (_getSuperRef = getSuperRef()) != null ? _getSuperRef : memberExpression(identifier("Function"), identifier("prototype"));
} else {
var _getSuperRef2;
object = memberExpression((_getSuperRef2 = getSuperRef()) != null ? _getSuperRef2 : identifier("Object"), identifier("prototype"));
}
return memberExpression(object, prop, computed);
},
set(superMember, value) {
const {
computed
} = superMember.node;
const prop = this.prop(superMember);
return assignmentExpression("=", memberExpression(thisExpression(), prop, computed), value);
},
destructureSet(superMember) {
const {
computed
} = superMember.node;
const prop = this.prop(superMember);
return memberExpression(thisExpression(), prop, computed);
},
call(superMember, args) {
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), thisExpression(), args, false);
},
optionalCall(superMember, args) {
return (0, _helperOptimiseCallExpression.default)(this.get(superMember), thisExpression(), args, true);
}
});
class ReplaceSupers {
constructor(opts) {
var _opts$constantSuper;
const path = opts.methodPath;
this.methodPath = path;
this.isDerivedConstructor = path.isClassMethod({
kind: "constructor"
}) && !!opts.superRef;
this.isStatic = path.isObjectMethod() || path.node.static || (path.isStaticBlock == null ? void 0 : path.isStaticBlock());
this.isPrivateMethod = path.isPrivate() && path.isMethod();
this.file = opts.file;
this.constantSuper = (_opts$constantSuper = opts.constantSuper) != null ? _opts$constantSuper : opts.isLoose;
this.opts = opts;
}
getObjectRef() {
return cloneNode(this.opts.objectRef || this.opts.getObjectRef());
}
getSuperRef() {
if (this.opts.superRef) return cloneNode(this.opts.superRef);
if (this.opts.getSuperRef) {
return cloneNode(this.opts.getSuperRef());
}
}
replace() {
if (this.opts.refToPreserve) {
this.methodPath.traverse(unshadowSuperBindingVisitor, {
refName: this.opts.refToPreserve.name
});
}
const handler = this.constantSuper ? looseHandlers : specHandlers;
(0, _helperMemberExpressionToFunctions.default)(this.methodPath, visitor, Object.assign({
file: this.file,
scope: this.methodPath.scope,
isDerivedConstructor: this.isDerivedConstructor,
isStatic: this.isStatic,
isPrivateMethod: this.isPrivateMethod,
getObjectRef: this.getObjectRef.bind(this),
getSuperRef: this.getSuperRef.bind(this),
boundGet: handler.get
}, handler));
}
}
exports.default = ReplaceSupers;
\ No newline at end of file
{
"name": "@babel/helper-replace-supers",
"version": "7.18.6",
"description": "Helper function to replace supers",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-helper-replace-supers"
},
"homepage": "https://babel.dev/docs/en/next/babel-helper-replace-supers",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "./lib/index.js",
"dependencies": {
"@babel/helper-environment-visitor": "^7.18.6",
"@babel/helper-member-expression-to-functions": "^7.18.6",
"@babel/helper-optimise-call-expression": "^7.18.6",
"@babel/traverse": "^7.18.6",
"@babel/types": "^7.18.6"
},
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)",
"type": "commonjs"
}
\ No newline at end of file
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.
# @babel/helper-simple-access
> Babel helper for ensuring that access to a given value is performed through simple accesses
See our website [@babel/helper-simple-access](https://babeljs.io/docs/en/babel-helper-simple-access) for more information.
## Install
Using npm:
```sh
npm install --save @babel/helper-simple-access
```
or using yarn:
```sh
yarn add @babel/helper-simple-access
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = simplifyAccess;
var _t = require("@babel/types");
const {
LOGICAL_OPERATORS,
assignmentExpression,
binaryExpression,
cloneNode,
identifier,
logicalExpression,
numericLiteral,
sequenceExpression,
unaryExpression
} = _t;
function simplifyAccess(path, bindingNames, includeUpdateExpression = true) {
path.traverse(simpleAssignmentVisitor, {
scope: path.scope,
bindingNames,
seen: new WeakSet(),
includeUpdateExpression
});
}
const simpleAssignmentVisitor = {
UpdateExpression: {
exit(path) {
const {
scope,
bindingNames,
includeUpdateExpression
} = this;
if (!includeUpdateExpression) {
return;
}
const arg = path.get("argument");
if (!arg.isIdentifier()) return;
const localName = arg.node.name;
if (!bindingNames.has(localName)) return;
if (scope.getBinding(localName) !== path.scope.getBinding(localName)) {
return;
}
if (path.parentPath.isExpressionStatement() && !path.isCompletionRecord()) {
const operator = path.node.operator == "++" ? "+=" : "-=";
path.replaceWith(assignmentExpression(operator, arg.node, numericLiteral(1)));
} else if (path.node.prefix) {
path.replaceWith(assignmentExpression("=", identifier(localName), binaryExpression(path.node.operator[0], unaryExpression("+", arg.node), numericLiteral(1))));
} else {
const old = path.scope.generateUidIdentifierBasedOnNode(arg.node, "old");
const varName = old.name;
path.scope.push({
id: old
});
const binary = binaryExpression(path.node.operator[0], identifier(varName), numericLiteral(1));
path.replaceWith(sequenceExpression([assignmentExpression("=", identifier(varName), unaryExpression("+", arg.node)), assignmentExpression("=", cloneNode(arg.node), binary), identifier(varName)]));
}
}
},
AssignmentExpression: {
exit(path) {
const {
scope,
seen,
bindingNames
} = this;
if (path.node.operator === "=") return;
if (seen.has(path.node)) return;
seen.add(path.node);
const left = path.get("left");
if (!left.isIdentifier()) return;
const localName = left.node.name;
if (!bindingNames.has(localName)) return;
if (scope.getBinding(localName) !== path.scope.getBinding(localName)) {
return;
}
const operator = path.node.operator.slice(0, -1);
if (LOGICAL_OPERATORS.includes(operator)) {
path.replaceWith(logicalExpression(operator, path.node.left, assignmentExpression("=", cloneNode(path.node.left), path.node.right)));
} else {
path.node.right = binaryExpression(operator, cloneNode(path.node.left), path.node.right);
path.node.operator = "=";
}
}
}
};
\ No newline at end of file
{
"name": "@babel/helper-simple-access",
"version": "7.18.6",
"description": "Babel helper for ensuring that access to a given value is performed through simple accesses",
"author": "The Babel Team (https://babel.dev/team)",
"homepage": "https://babel.dev/docs/en/next/babel-helper-simple-access",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-helper-simple-access"
},
"main": "./lib/index.js",
"dependencies": {
"@babel/types": "^7.18.6"
},
"devDependencies": {
"@babel/traverse": "^7.18.6"
},
"engines": {
"node": ">=6.9.0"
},
"type": "commonjs"
}
\ No newline at end of file
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.
# @babel/helper-skip-transparent-expression-wrappers
> Helper which skips types and parentheses
See our website [@babel/helper-skip-transparent-expression-wrappers](https://babeljs.io/docs/en/babel-helper-skip-transparent-expression-wrappers) for more information.
## Install
Using npm:
```sh
npm install --save @babel/helper-skip-transparent-expression-wrappers
```
or using yarn:
```sh
yarn add @babel/helper-skip-transparent-expression-wrappers
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.isTransparentExprWrapper = isTransparentExprWrapper;
exports.skipTransparentExprWrapperNodes = skipTransparentExprWrapperNodes;
exports.skipTransparentExprWrappers = skipTransparentExprWrappers;
var _t = require("@babel/types");
const {
isParenthesizedExpression,
isTSAsExpression,
isTSNonNullExpression,
isTSTypeAssertion,
isTypeCastExpression
} = _t;
function isTransparentExprWrapper(node) {
return isTSAsExpression(node) || isTSTypeAssertion(node) || isTSNonNullExpression(node) || isTypeCastExpression(node) || isParenthesizedExpression(node);
}
function skipTransparentExprWrappers(path) {
while (isTransparentExprWrapper(path.node)) {
path = path.get("expression");
}
return path;
}
function skipTransparentExprWrapperNodes(node) {
while (isTransparentExprWrapper(node)) {
node = node.expression;
}
return node;
}
\ No newline at end of file
{
"name": "@babel/helper-skip-transparent-expression-wrappers",
"version": "7.18.6",
"description": "Helper which skips types and parentheses",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-helper-skip-transparent-expression-wrappers"
},
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "./lib/index.js",
"exports": {
".": "./lib/index.js",
"./package.json": "./package.json"
},
"dependencies": {
"@babel/types": "^7.18.6"
},
"devDependencies": {
"@babel/traverse": "^7.18.6"
},
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)",
"type": "commonjs"
}
\ No newline at end of file
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.
# @babel/helper-split-export-declaration
>
See our website [@babel/helper-split-export-declaration](https://babeljs.io/docs/en/babel-helper-split-export-declaration) for more information.
## Install
Using npm:
```sh
npm install --save @babel/helper-split-export-declaration
```
or using yarn:
```sh
yarn add @babel/helper-split-export-declaration
```
"use strict";
Object.defineProperty(exports, "__esModule", {
value: true
});
exports.default = splitExportDeclaration;
var _t = require("@babel/types");
const {
cloneNode,
exportNamedDeclaration,
exportSpecifier,
identifier,
variableDeclaration,
variableDeclarator
} = _t;
function splitExportDeclaration(exportDeclaration) {
if (!exportDeclaration.isExportDeclaration() || exportDeclaration.isExportAllDeclaration()) {
throw new Error("Only default and named export declarations can be split.");
}
if (exportDeclaration.isExportDefaultDeclaration()) {
const declaration = exportDeclaration.get("declaration");
const standaloneDeclaration = declaration.isFunctionDeclaration() || declaration.isClassDeclaration();
const scope = declaration.isScope() ? declaration.scope.parent : declaration.scope;
let id = declaration.node.id;
let needBindingRegistration = false;
if (!id) {
needBindingRegistration = true;
id = scope.generateUidIdentifier("default");
if (standaloneDeclaration || declaration.isFunctionExpression() || declaration.isClassExpression()) {
declaration.node.id = cloneNode(id);
}
}
const updatedDeclaration = standaloneDeclaration ? declaration.node : variableDeclaration("var", [variableDeclarator(cloneNode(id), declaration.node)]);
const updatedExportDeclaration = exportNamedDeclaration(null, [exportSpecifier(cloneNode(id), identifier("default"))]);
exportDeclaration.insertAfter(updatedExportDeclaration);
exportDeclaration.replaceWith(updatedDeclaration);
if (needBindingRegistration) {
scope.registerDeclaration(exportDeclaration);
}
return exportDeclaration;
} else if (exportDeclaration.get("specifiers").length > 0) {
throw new Error("It doesn't make sense to split exported specifiers.");
}
const declaration = exportDeclaration.get("declaration");
const bindingIdentifiers = declaration.getOuterBindingIdentifiers();
const specifiers = Object.keys(bindingIdentifiers).map(name => {
return exportSpecifier(identifier(name), identifier(name));
});
const aliasDeclar = exportNamedDeclaration(null, specifiers);
exportDeclaration.insertAfter(aliasDeclar);
exportDeclaration.replaceWith(declaration.node);
return exportDeclaration;
}
\ No newline at end of file
{
"name": "@babel/helper-split-export-declaration",
"version": "7.18.6",
"description": "",
"repository": {
"type": "git",
"url": "https://github.com/babel/babel.git",
"directory": "packages/babel-helper-split-export-declaration"
},
"homepage": "https://babel.dev/docs/en/next/babel-helper-split-export-declaration",
"license": "MIT",
"publishConfig": {
"access": "public"
},
"main": "./lib/index.js",
"dependencies": {
"@babel/types": "^7.18.6"
},
"engines": {
"node": ">=6.9.0"
},
"author": "The Babel Team (https://babel.dev/team)",
"type": "commonjs"
}
\ No newline at end of file
MIT License
Copyright (c) 2014-present Sebastian McKenzie and other contributors
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.
# @babel/helper-validator-option
> Validate plugin/preset options
See our website [@babel/helper-validator-option](https://babeljs.io/docs/en/babel-helper-validator-option) for more information.
## Install
Using npm:
```sh
npm install --save @babel/helper-validator-option
```
or using yarn:
```sh
yarn add @babel/helper-validator-option
```
"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))];
}
\ No newline at end of file
"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");
\ No newline at end of file
Markdown is supported
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment