Travis build: 1045 [cron]

This commit is contained in:
30secondsofcode
2019-03-06 15:13:18 +00:00
parent 08c9806c72
commit 2493c5ab62
7 changed files with 37 additions and 37 deletions

View File

@ -1331,11 +1331,11 @@
"type": "snippet",
"attributes": {
"fileName": "differenceBy.md",
"text": "Returns the difference between two arrays, after applying the provided function to each array element of both.\n\nCreate a `Set` by applying `fn` to each element in `b`, then use `Array.prototype.filter()` in combination with `fn` on `a` to only keep values not contained in the previously created set.",
"text": "Returns the difference between two arrays, after applying the provided function to each array element of both.\n\nCreate a `Set` by applying `fn` to each element in `b`, then use `Array.prototype.map()` to apply `fn` to each element in `a`, then `Array.prototype.filter()`",
"codeBlocks": {
"es6": "const differenceBy = (a, b, fn) => {\n const s = new Set(b.map(fn));\n return a.filter(x => !s.has(fn(x)));\n};",
"es5": "var differenceBy = function differenceBy(a, b, fn) {\n var s = new Set(b.map(fn));\n return a.filter(function (x) {\n return !s.has(fn(x));\n });\n};",
"example": "differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); // [1.2]\ndifferenceBy([{ x: 2 }, { x: 1 }], [{ x: 1 }], v => v.x); // [ { x: 2 } ]"
"es6": "const differenceBy = (a, b, fn) => {\n const s = new Set(b.map(fn));\n return a.map(fn).filter(el => !s.has(el));\n};",
"es5": "var differenceBy = function differenceBy(a, b, fn) {\n var s = new Set(b.map(fn));\n return a.map(fn).filter(function (el) {\n return !s.has(el);\n });\n};",
"example": "differenceBy([2.1, 1.2], [2.3, 3.4], Math.floor); // [1]\ndifferenceBy([{ x: 2 }, { x: 1 }], [{ x: 1 }], v => v.x); // [2]"
},
"tags": [
"array",
@ -1345,7 +1345,7 @@
},
"meta": {
"archived": false,
"hash": "92abc752f5d3a659467e3dde7a3890000f4b72d1fdfd66086092494b688506ae"
"hash": "01f5f57c5b2663808e733b98e13dfd47d501ab010e681dd49219548816d1a3d0"
}
},
{
@ -1703,7 +1703,7 @@
"fileName": "factorial.md",
"text": "Calculates the factorial of a number.\n\nUse recursion.\nIf `n` is less than or equal to `1`, return `1`.\nOtherwise, return the product of `n` and the factorial of `n - 1`.\nThrows an exception if `n` is a negative number.",
"codeBlocks": {
"es6": "const factorial = n =>\n n < 0\n ? (() => {\n throw new TypeError('Negative numbers are not allowed!');\n })()\n : n <= 1\n ? 1\n : n * factorial(n - 1);",
"es6": "const factorial = n =>\n n < 0\n ? (() => {\n throw new TypeError('Negative numbers are not allowed!');\n })()\n : n <= 1\n ? 1\n : n * factorial(n - 1);",
"es5": "var factorial = function factorial(n) {\n return n < 0 ? function () {\n throw new TypeError('Negative numbers are not allowed!');\n }() : n <= 1 ? 1 : n * factorial(n - 1);\n};",
"example": "factorial(6); // 720"
},
@ -1715,7 +1715,7 @@
},
"meta": {
"archived": false,
"hash": "383ed61e69b8f63ae42d0746a1995057f4f65b4af6ca7778d8f1771144802acd"
"hash": "319e1a8fb41490965ee6e28db3e139e65c4ea5b7f43e332bc7216cd790e5d409"
}
},
{
@ -4983,7 +4983,7 @@
"codeBlocks": {
"es6": "const pipeAsyncFunctions = (...fns) => arg => fns.reduce((p, f) => p.then(f), Promise.resolve(arg));",
"es5": "var pipeAsyncFunctions = function pipeAsyncFunctions() {\n for (var _len = arguments.length, fns = new Array(_len), _key = 0; _key < _len; _key++) {\n fns[_key] = arguments[_key];\n }\n\n return function (arg) {\n return fns.reduce(function (p, f) {\n return p.then(f);\n }, Promise.resolve(arg));\n };\n};",
"example": "const sum = pipeAsyncFunctions(\n x => x + 1,\n x => new Promise(resolve => setTimeout(() => resolve(x + 2), 1000)),\n x => x + 3,\n async x => (await x) + 4\n);\n(async() => {\n console.log(await sum(5)); // 15 (after one second)\n})();"
"example": "const sum = pipeAsyncFunctions(\n x => x + 1,\n x => new Promise(resolve => setTimeout(() => resolve(x + 2), 1000)),\n x => x + 3,\n async x => (await x) + 4\n);\n(async () => {\n console.log(await sum(5)); // 15 (after one second)\n})();"
},
"tags": [
"adapter",
@ -4994,7 +4994,7 @@
},
"meta": {
"archived": false,
"hash": "4815876fd6dbb17ad34c0d8918e7a72d837104f9beee7dc51b0fa73057b9e83e"
"hash": "dcdf66e8d0eb4a1761c6b767b8cc350757087ae817ec371436faab0fff7c0051"
}
},
{
@ -5530,7 +5530,7 @@
"fileName": "remove.md",
"text": "Removes elements from an array for which the given function returns `false`.\n\nUse `Array.prototype.filter()` to find array elements that return truthy values and `Array.prototype.reduce()` to remove elements using `Array.prototype.splice()`.\nThe `func` is invoked with three arguments (`value, index, array`).",
"codeBlocks": {
"es6": "const remove = (arr, func) =>\n Array.isArray(arr)\n ? arr.filter(func).reduce((acc, val) => {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, [])\n : [];",
"es6": "const remove = (arr, func) =>\n Array.isArray(arr)\n ? arr.filter(func).reduce((acc, val) => {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, [])\n : [];",
"es5": "var remove = function remove(arr, func) {\n return Array.isArray(arr) ? arr.filter(func).reduce(function (acc, val) {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, []) : [];\n};",
"example": "remove([1, 2, 3, 4], n => n % 2 === 0); // [2, 4]"
},
@ -5541,7 +5541,7 @@
},
"meta": {
"archived": false,
"hash": "ec9cb9384817f84cf0bacd62a23b69b2304fa2cf0352b16d3950b21d48c04f11"
"hash": "2fd54c9fc1fb5b0a981df69501b518d5830ea77544d4d5290c7cc13745ca00ea"
}
},
{