Travis build: 188 [cron]
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -2249,7 +2249,7 @@
|
|||||||
"fileName": "indexOfAll.md",
|
"fileName": "indexOfAll.md",
|
||||||
"text": "Returns all indices of `val` in an array. If `val` never occurs, returns `[]`.\n\nUse `Array.reduce()` to loop over elements and store indices for matching elements.\nReturn the array of indices.",
|
"text": "Returns all indices of `val` in an array. If `val` never occurs, returns `[]`.\n\nUse `Array.reduce()` to loop over elements and store indices for matching elements.\nReturn the array of indices.",
|
||||||
"codeBlocks": [
|
"codeBlocks": [
|
||||||
"const indexOfAll = (arr, val) => (arr, val) =>\n arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []);",
|
"const indexOfAll = (arr, val) => arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []);",
|
||||||
"indexOfAll([1, 2, 3, 1, 2, 3], 1); // [0,3]\nindexOfAll([1, 2, 3], 4); // []"
|
"indexOfAll([1, 2, 3, 1, 2, 3], 1); // [0,3]\nindexOfAll([1, 2, 3], 4); // []"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
@ -2258,7 +2258,7 @@
|
|||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": false,
|
"archived": false,
|
||||||
"hash": "785b13b5ab3ecdeab0c40e4b4103818daf5e1ef9c2213eb19f9a41d77bfd6734"
|
"hash": "643cb7b5df16c9da268e21b65b4cf73bb572e7b93a5859d09bb3bc949665f65b"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const httpDelete = (url, callback, err = console.error) => {
|
const httpDelete = (url, callback, err = console.error) => {
|
||||||
const request = new XMLHttpRequest();
|
const request = new XMLHttpRequest();
|
||||||
request.open('DELETE', url, true);
|
request.open("DELETE", url, true);
|
||||||
request.onload = () => callback(request);
|
request.onload = () => callback(request);
|
||||||
request.onerror = () => err(request);
|
request.onerror = () => err(request);
|
||||||
request.send();
|
request.send();
|
||||||
|
|||||||
@ -1,6 +1,6 @@
|
|||||||
const httpPut = (url, data, callback, err = console.error) => {
|
const httpPut = (url, data, callback, err = console.error) => {
|
||||||
const request = new XMLHttpRequest();
|
const request = new XMLHttpRequest();
|
||||||
request.open('PUT', url, true);
|
request.open("PUT", url, true);
|
||||||
request.setRequestHeader('Content-type','application/json; charset=utf-8');
|
request.setRequestHeader('Content-type','application/json; charset=utf-8');
|
||||||
request.onload = () => callback(request);
|
request.onload = () => callback(request);
|
||||||
request.onerror = () => err(request);
|
request.onerror = () => err(request);
|
||||||
|
|||||||
@ -1,3 +1,2 @@
|
|||||||
const indexOfAll = (arr, val) => (arr, val) =>
|
const indexOfAll = (arr, val) => arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []);
|
||||||
arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []);
|
|
||||||
module.exports = indexOfAll;
|
module.exports = indexOfAll;
|
||||||
|
|||||||
@ -1,11 +1,5 @@
|
|||||||
const isSimilar = (pattern, str) =>
|
const isSimilar = (pattern, str) =>
|
||||||
[...str].reduce(
|
[...str].reduce(
|
||||||
(matchIndex, char) =>
|
(matchIndex, char) => char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase() ? matchIndex + 1 : matchIndex, 0
|
||||||
char.toLowerCase() === (pattern[matchIndex] || '').toLowerCase()
|
) === pattern.length ? true : false;
|
||||||
? matchIndex + 1
|
|
||||||
: matchIndex,
|
|
||||||
0
|
|
||||||
) === pattern.length
|
|
||||||
? true
|
|
||||||
: false;
|
|
||||||
module.exports = isSimilar;
|
module.exports = isSimilar;
|
||||||
|
|||||||
@ -1,22 +1,15 @@
|
|||||||
const levenshteinDistance = (string1, string2) => {
|
const levenshteinDistance = (string1, string2) => {
|
||||||
if(string1.length === 0) return string2.length;
|
if(string1.length === 0) return string2.length;
|
||||||
if(string2.length === 0) return string1.length;
|
if(string2.length === 0) return string1.length;
|
||||||
let matrix = Array(string2.length + 1)
|
let matrix = Array(string2.length + 1).fill(0).map((x,i) => [i]);
|
||||||
.fill(0)
|
matrix[0] = Array(string1.length + 1).fill(0).map((x,i) => i);
|
||||||
.map((x, i) => [i]);
|
|
||||||
matrix[0] = Array(string1.length + 1)
|
|
||||||
.fill(0)
|
|
||||||
.map((x, i) => i);
|
|
||||||
for(let i = 1; i <= string2.length; i++) {
|
for(let i = 1; i <= string2.length; i++) {
|
||||||
for(let j = 1; j<=string1.length; j++) {
|
for(let j = 1; j<=string1.length; j++) {
|
||||||
if(string2[i-1] === string1[j-1]) {
|
if(string2[i-1] === string1[j-1]) {
|
||||||
matrix[i][j] = matrix[i-1][j-1];
|
matrix[i][j] = matrix[i-1][j-1];
|
||||||
} else {
|
}
|
||||||
matrix[i][j] = Math.min(
|
else{
|
||||||
matrix[i - 1][j - 1] + 1,
|
matrix[i][j] = Math.min(matrix[i-1][j-1]+1, matrix[i][j-1]+1, matrix[i-1][j]+1);
|
||||||
matrix[i][j - 1] + 1,
|
|
||||||
matrix[i - 1][j] + 1
|
|
||||||
);
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
3215
test/testlog
3215
test/testlog
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user