1
0
mirror of https://github.com/actions/labeler synced 2026-05-10 05:51:02 +02:00
This commit is contained in:
David Kale
2020-09-08 13:25:36 -04:00
parent e4246d2b5b
commit 91fcbb0108
4227 changed files with 416837 additions and 457884 deletions

92
node_modules/leven/index.js generated vendored
View File

@@ -1,85 +1,77 @@
/* eslint-disable no-nested-ternary */
'use strict';
var arr = [];
var charCodeCache = [];
const array = [];
const charCodeCache = [];
module.exports = function (a, b) {
if (a === b) {
const leven = (left, right) => {
if (left === right) {
return 0;
}
var swap = a;
const swap = left;
// Swapping the strings if `a` is longer than `b` so we know which one is the
// shortest & which one is the longest
if (a.length > b.length) {
a = b;
b = swap;
if (left.length > right.length) {
left = right;
right = swap;
}
var aLen = a.length;
var bLen = b.length;
if (aLen === 0) {
return bLen;
}
if (bLen === 0) {
return aLen;
}
let leftLength = left.length;
let rightLength = right.length;
// Performing suffix trimming:
// We can linearly drop suffix common to both strings since they
// don't increase distance at all
// Note: `~-` is the bitwise way to perform a `- 1` operation
while (aLen > 0 && (a.charCodeAt(~-aLen) === b.charCodeAt(~-bLen))) {
aLen--;
bLen--;
}
if (aLen === 0) {
return bLen;
while (leftLength > 0 && (left.charCodeAt(~-leftLength) === right.charCodeAt(~-rightLength))) {
leftLength--;
rightLength--;
}
// Performing prefix trimming
// We can linearly drop prefix common to both strings since they
// don't increase distance at all
var start = 0;
let start = 0;
while (start < aLen && (a.charCodeAt(start) === b.charCodeAt(start))) {
while (start < leftLength && (left.charCodeAt(start) === right.charCodeAt(start))) {
start++;
}
aLen -= start;
bLen -= start;
leftLength -= start;
rightLength -= start;
if (aLen === 0) {
return bLen;
if (leftLength === 0) {
return rightLength;
}
var bCharCode;
var ret;
var tmp;
var tmp2;
var i = 0;
var j = 0;
let bCharCode;
let result;
let temp;
let temp2;
let i = 0;
let j = 0;
while (i < aLen) {
charCodeCache[start + i] = a.charCodeAt(start + i);
arr[i] = ++i;
while (i < leftLength) {
charCodeCache[i] = left.charCodeAt(start + i);
array[i] = ++i;
}
while (j < bLen) {
bCharCode = b.charCodeAt(start + j);
tmp = j++;
ret = j;
while (j < rightLength) {
bCharCode = right.charCodeAt(start + j);
temp = j++;
result = j;
for (i = 0; i < aLen; i++) {
tmp2 = bCharCode === charCodeCache[start + i] ? tmp : tmp + 1;
tmp = arr[i];
ret = arr[i] = tmp > ret ? tmp2 > ret ? ret + 1 : tmp2 : tmp2 > tmp ? tmp + 1 : tmp2;
for (i = 0; i < leftLength; i++) {
temp2 = bCharCode === charCodeCache[i] ? temp : temp + 1;
temp = array[i];
// eslint-disable-next-line no-multi-assign
result = array[i] = temp > result ? temp2 > result ? result + 1 : temp2 : temp2 > temp ? temp + 1 : temp2;
}
}
return ret;
return result;
};
module.exports = leven;
// TODO: Remove this for the next major release
module.exports.default = leven;