Travis build: 233 [cron]
This commit is contained in:
File diff suppressed because one or more lines are too long
@ -3198,9 +3198,9 @@
|
|||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"fileName": "longestItem.md",
|
"fileName": "longestItem.md",
|
||||||
"text": "Takes any number of iterable objects or objects with a `length` property and returns the longest one.\n\nUse `Array.reduce()` to collect the longest element. Returns [] for empty array.",
|
"text": "Takes any number of iterable objects or objects with a `length` property and returns the longest one.\nIf multiple objects have the same length, the first one will be returned.\nReturns `undefined` if no arguments are provided.\n\nUse `Array.reduce()`, comparing the `length` of objects to find the longest one.",
|
||||||
"codeBlocks": [
|
"codeBlocks": [
|
||||||
"const longestItem = (...vals) => [...vals].reduce((a, x) => (a.length > x.length ? a : x), []);",
|
"const longestItem = (val, ...vals) =>\n [val, ...vals].reduce((a, x) => (x.length > a.length ? x : a));",
|
||||||
"longestItem('this', 'is', 'a', 'testcase'); // 'testcase'\nlongestItem(...['a', 'ab', 'abc']); // 'abc'\nlongestItem(...['a', 'ab', 'abc'], 'abcd'); // 'abcd'\nlongestItem([1, 2, 3], [1, 2], [1, 2, 3, 4, 5]); // [1, 2, 3, 4, 5]\nlongestItem([1, 2, 3], 'foobar'); // 'foobar'"
|
"longestItem('this', 'is', 'a', 'testcase'); // 'testcase'\nlongestItem(...['a', 'ab', 'abc']); // 'abc'\nlongestItem(...['a', 'ab', 'abc'], 'abcd'); // 'abcd'\nlongestItem([1, 2, 3], [1, 2], [1, 2, 3, 4, 5]); // [1, 2, 3, 4, 5]\nlongestItem([1, 2, 3], 'foobar'); // 'foobar'"
|
||||||
],
|
],
|
||||||
"tags": [
|
"tags": [
|
||||||
@ -3211,7 +3211,7 @@
|
|||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"archived": false,
|
"archived": false,
|
||||||
"hash": "255f7c6b0838d0f587c7e361535eedd09d56abce74aa7d6e59e4e224e42869fc"
|
"hash": "cb9de7acf3a94ee67a24d7d5926944124ad0bd3459126c2f740f868fbffc655b"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -1,2 +1,3 @@
|
|||||||
const longestItem = (val, ...vals) => [val, ...vals].reduce((a, x) => x.length > a.length ? x : a);
|
const longestItem = (val, ...vals) =>
|
||||||
|
[val, ...vals].reduce((a, x) => (x.length > a.length ? x : a));
|
||||||
module.exports = longestItem;
|
module.exports = longestItem;
|
||||||
|
|||||||
3171
test/testlog
3171
test/testlog
File diff suppressed because it is too large
Load Diff
Reference in New Issue
Block a user