Travis build: 1341 [cron]

This commit is contained in:
30secondsofcode
2019-08-12 16:28:43 +00:00
parent 43b75db27c
commit a5164f392a
7 changed files with 18 additions and 18 deletions

4
dist/_30s.es5.js vendored
View File

@ -807,7 +807,7 @@
return arr.filter(fn).pop();
};
var findLastIndex = function findLastIndex(arr, fn) {
return arr.map(function (val, i) {
return (arr.map(function (val, i) {
return [i, val];
}).filter(function (_ref8) {
var _ref9 = _slicedToArray(_ref8, 2),
@ -815,7 +815,7 @@
val = _ref9[1];
return fn(val, i, arr);
}).pop()[0];
}).pop() || [-1])[0];
};
var findLastKey = function findLastKey(obj, fn) {
return Object.keys(obj).reverse().find(function (key) {

File diff suppressed because one or more lines are too long

4
dist/_30s.esm.js vendored
View File

@ -361,10 +361,10 @@ const filterNonUniqueBy = (arr, fn) =>
const findKey = (obj, fn) => Object.keys(obj).find(key => fn(obj[key], key, obj));
const findLast = (arr, fn) => arr.filter(fn).pop();
const findLastIndex = (arr, fn) =>
arr
(arr
.map((val, i) => [i, val])
.filter(([i, val]) => fn(val, i, arr))
.pop()[0];
.pop() || [-1])[0];
const findLastKey = (obj, fn) =>
Object.keys(obj)
.reverse()

4
dist/_30s.js vendored
View File

@ -367,10 +367,10 @@
const findKey = (obj, fn) => Object.keys(obj).find(key => fn(obj[key], key, obj));
const findLast = (arr, fn) => arr.filter(fn).pop();
const findLastIndex = (arr, fn) =>
arr
(arr
.map((val, i) => [i, val])
.filter(([i, val]) => fn(val, i, arr))
.pop()[0];
.pop() || [-1])[0];
const findLastKey = (obj, fn) =>
Object.keys(obj)
.reverse()

View File

@ -386,7 +386,7 @@
"archived": false
},
"meta": {
"hash": "8dcc260ee20fc2b7e5a17785db0c0b4ff357cea38a488d5219e47f93805bcade"
"hash": "d0eace2a9fcd0b8e056083e8c3e92574d7da0eee62c6897f7d6c5a94e64a3841"
}
},
{
@ -1294,7 +1294,7 @@
"archived": false
},
"meta": {
"hash": "579dc87863861d3e586fe7f0c707779fe45704612108c6b0bbed5b643126ab40"
"hash": "fab98b5b3be137f0421660cba5c6d3b26206def5b80c1782c135a354846ba5db"
}
},
{

View File

@ -568,7 +568,7 @@
},
"meta": {
"archived": false,
"hash": "8dcc260ee20fc2b7e5a17785db0c0b4ff357cea38a488d5219e47f93805bcade"
"hash": "d0eace2a9fcd0b8e056083e8c3e92574d7da0eee62c6897f7d6c5a94e64a3841"
}
},
{
@ -1896,11 +1896,11 @@
"type": "snippet",
"attributes": {
"fileName": "findLastIndex.md",
"text": "Returns the index of the last element for which the provided function returns a truthy value.\n\nUse `Array.prototype.map()` to map each element to an array with its index and value.\nUse `Array.prototype.filter()` to remove elements for which `fn` returns falsy values, `Array.prototype.pop()` to get the last one.",
"text": "Returns the index of the last element for which the provided function returns a truthy value.\n\nUse `Array.prototype.map()` to map each element to an array with its index and value.\nUse `Array.prototype.filter()` to remove elements for which `fn` returns falsy values, `Array.prototype.pop()` to get the last one.\n`-1` is the default value when not found.",
"codeBlocks": {
"es6": "const findLastIndex = (arr, fn) =>\n arr\n .map((val, i) => [i, val])\n .filter(([i, val]) => fn(val, i, arr))\n .pop()[0];",
"es5": "function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar findLastIndex = function findLastIndex(arr, fn) {\n return arr.map(function (val, i) {\n return [i, val];\n }).filter(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n i = _ref2[0],\n val = _ref2[1];\n\n return fn(val, i, arr);\n }).pop()[0];\n};",
"example": "findLastIndex([1, 2, 3, 4], n => n % 2 === 1); // 2 (index of the value 3)"
"es6": "const findLastIndex = (arr, fn) =>\n (arr\n .map((val, i) => [i, val])\n .filter(([i, val]) => fn(val, i, arr))\n .pop() || [-1])[0];",
"es5": "function _slicedToArray(arr, i) { return _arrayWithHoles(arr) || _iterableToArrayLimit(arr, i) || _nonIterableRest(); }\n\nfunction _nonIterableRest() { throw new TypeError(\"Invalid attempt to destructure non-iterable instance\"); }\n\nfunction _iterableToArrayLimit(arr, i) { var _arr = []; var _n = true; var _d = false; var _e = undefined; try { for (var _i = arr[Symbol.iterator](), _s; !(_n = (_s = _i.next()).done); _n = true) { _arr.push(_s.value); if (i && _arr.length === i) break; } } catch (err) { _d = true; _e = err; } finally { try { if (!_n && _i[\"return\"] != null) _i[\"return\"](); } finally { if (_d) throw _e; } } return _arr; }\n\nfunction _arrayWithHoles(arr) { if (Array.isArray(arr)) return arr; }\n\nvar findLastIndex = function findLastIndex(arr, fn) {\n return (arr.map(function (val, i) {\n return [i, val];\n }).filter(function (_ref) {\n var _ref2 = _slicedToArray(_ref, 2),\n i = _ref2[0],\n val = _ref2[1];\n\n return fn(val, i, arr);\n }).pop() || [-1])[0];\n};",
"example": "findLastIndex([1, 2, 3, 4], n => n % 2 === 1); // 2 (index of the value 3)\nfindLastIndex([1, 2, 3, 4], n => n === 5); // -1 (default value when not found)"
},
"tags": [
"array",
@ -1910,7 +1910,7 @@
},
"meta": {
"archived": false,
"hash": "579dc87863861d3e586fe7f0c707779fe45704612108c6b0bbed5b643126ab40"
"hash": "fab98b5b3be137f0421660cba5c6d3b26206def5b80c1782c135a354846ba5db"
}
},
{

View File

@ -855,12 +855,12 @@
"prefix": "30s_findLastIndex",
"body": [
"const findLastIndex = (arr, fn) =>",
" arr",
" (arr",
" .map((val, i) => [i, val])",
" .filter(([i, val]) => fn(val, i, arr))",
" .pop()[0];"
" .pop() || [-1])[0];"
],
"description": "Returns the index of the last element for which the provided function returns a truthy value.\n\nUse `Array.prototype.map()` to map each element to an array with its index and value.\nUse `Array.prototype.filter()` to remove elements for which `fn` returns falsy values, `Array.prototype.pop()` to get the last one"
"description": "Returns the index of the last element for which the provided function returns a truthy value.\n\nUse `Array.prototype.map()` to map each element to an array with its index and value.\nUse `Array.prototype.filter()` to remove elements for which `fn` returns falsy values, `Array.prototype.pop()` to get the last one.\n`-1` is the default value when not found"
},
"findLastKey": {
"prefix": "30s_findLastKey",