Travis build: 574 [cron]
This commit is contained in:
@ -3250,7 +3250,7 @@
|
|||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"fileName": "isString.md",
|
"fileName": "isString.md",
|
||||||
"text": "Checks if the given argument is a string.\n\nUse `typeof` to check if a value is classified as a string primitive.",
|
"text": "Checks if the given argument is a string. Only works for string primitives.\n\nUse `typeof` to check if a value is classified as a string primitive.",
|
||||||
"codeBlocks": [
|
"codeBlocks": [
|
||||||
"const isString = val => typeof val === 'string';",
|
"const isString = val => typeof val === 'string';",
|
||||||
"isString('10'); // true"
|
"isString('10'); // true"
|
||||||
@ -3263,7 +3263,7 @@
|
|||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": false,
|
"archived": false,
|
||||||
"hash": "1292c2a3504428962a0851e2f433aac67bfdd581f5abf08df967f5c8fef0954b"
|
"hash": "8cb7af2bd0a103563eee4e09266219630bf50c22048ad243d9456a24277ba615"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -5902,9 +5902,9 @@
|
|||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"fileName": "takeRightWhile.md",
|
"fileName": "takeRightWhile.md",
|
||||||
"text": "Removes elements from the end of an array until the passed function returns `true`. Returns the removed elements.\n\nLoop through the array, using a `for...of` loop over `Array.prototype.keys()` until the returned value from the function is `true`.\nReturn the removed elements, using `Array.prototype.reverse()` and `Array.prototype.slice()`.",
|
"text": "Removes elements from the end of an array until the passed function returns `true`. Returns the removed elements.\n\nLoop through the array, using a `Array.prototype.reduceRight()` and accumulating elements while the function returns falsy value.",
|
||||||
"codeBlocks": [
|
"codeBlocks": [
|
||||||
"const takeRightWhile = (arr, func) => {\n for (let i of arr.reverse().keys())\n if (func(arr[i])) return arr.reverse().slice(arr.length - i, arr.length);\n return arr;\n};",
|
"const takeRightWhile = (arr, func) =>\n arr.reduceRight((acc, el) => (func(el) ? acc : [el, ...acc]), []);",
|
||||||
"takeRightWhile([1, 2, 3, 4], n => n < 3); // [3, 4]"
|
"takeRightWhile([1, 2, 3, 4], n => n < 3); // [3, 4]"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
@ -5915,7 +5915,7 @@
|
|||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": false,
|
"archived": false,
|
||||||
"hash": "2b6b9c3c5e3e096c8b43ac7dfc389f8637e7eaf5cb77baea6e01f6506772fcc1"
|
"hash": "e229ed3f9dfffee8681ff978f7b1417b1a07b3820af0350f0c8b0332147a8525"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -322,7 +322,7 @@
|
|||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": true,
|
"archived": true,
|
||||||
"hash": "512b21ec623db482d6c0eefd0af6ce6787f86046d3a91320bedb91174a17120a"
|
"hash": "93e8862a89acd7be83ffbbb3f732759a84c9e9e7ebd5763251bcd265f8e7fbce"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -417,7 +417,7 @@ isSimilar('tr','Rohit'); // false
|
|||||||
|
|
||||||
Calculates the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) between two strings.
|
Calculates the [Levenshtein distance](https://en.wikipedia.org/wiki/Levenshtein_distance) between two strings.
|
||||||
|
|
||||||
Calculates the number of changes (substitutions, deletions or additions) required to convert `string1` to `string2`.
|
Calculates the number of changes (substitutions, deletions or additions) required to convert `string1` to `string2`.
|
||||||
Can also be used to compare two strings as shown in the second example.
|
Can also be used to compare two strings as shown in the second example.
|
||||||
|
|
||||||
``` js
|
``` js
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
const takeRightWhile = (arr, func) => arr.reduceRight((acc, el) => func(el) ? acc : [el, ...acc], []);
|
const takeRightWhile = (arr, func) =>
|
||||||
|
arr.reduceRight((acc, el) => (func(el) ? acc : [el, ...acc]), []);
|
||||||
module.exports = takeRightWhile;
|
module.exports = takeRightWhile;
|
||||||
|
|||||||
3208
test/testlog
3208
test/testlog
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user