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

4
dist/_30s.es5.js vendored
View File

@ -621,8 +621,8 @@
}; };
var differenceBy = function differenceBy(a, b, fn) { var differenceBy = function differenceBy(a, b, fn) {
var s = new Set(b.map(fn)); var s = new Set(b.map(fn));
return a.filter(function (x) { return a.map(fn).filter(function (el) {
return !s.has(fn(x)); return !s.has(el);
}); });
}; };
var differenceWith = function differenceWith(arr, val, comp) { var differenceWith = function differenceWith(arr, val, comp) {

File diff suppressed because one or more lines are too long

12
dist/_30s.esm.js vendored
View File

@ -257,7 +257,7 @@ const difference = (a, b) => {
}; };
const differenceBy = (a, b, fn) => { const differenceBy = (a, b, fn) => {
const s = new Set(b.map(fn)); const s = new Set(b.map(fn));
return a.filter(x => !s.has(fn(x))); return a.map(fn).filter(el => !s.has(el));
}; };
const differenceWith = (arr, val, comp) => arr.filter(a => val.findIndex(b => comp(a, b)) === -1); const differenceWith = (arr, val, comp) => arr.filter(a => val.findIndex(b => comp(a, b)) === -1);
const dig = (obj, target) => const dig = (obj, target) =>
@ -338,8 +338,8 @@ const extendHex = shortHex =>
const factorial = n => const factorial = n =>
n < 0 n < 0
? (() => { ? (() => {
throw new TypeError('Negative numbers are not allowed!'); throw new TypeError('Negative numbers are not allowed!');
})() })()
: n <= 1 : n <= 1
? 1 ? 1
: n * factorial(n - 1); : n * factorial(n - 1);
@ -985,9 +985,9 @@ const reject = (pred, array) => array.filter((...args) => !pred(...args));
const remove = (arr, func) => const remove = (arr, func) =>
Array.isArray(arr) Array.isArray(arr)
? arr.filter(func).reduce((acc, val) => { ? arr.filter(func).reduce((acc, val) => {
arr.splice(arr.indexOf(val), 1); arr.splice(arr.indexOf(val), 1);
return acc.concat(val); return acc.concat(val);
}, []) }, [])
: []; : [];
const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, ''); const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, '');
const renameKeys = (keysMap, obj) => const renameKeys = (keysMap, obj) =>

12
dist/_30s.js vendored
View File

@ -263,7 +263,7 @@
}; };
const differenceBy = (a, b, fn) => { const differenceBy = (a, b, fn) => {
const s = new Set(b.map(fn)); const s = new Set(b.map(fn));
return a.filter(x => !s.has(fn(x))); return a.map(fn).filter(el => !s.has(el));
}; };
const differenceWith = (arr, val, comp) => arr.filter(a => val.findIndex(b => comp(a, b)) === -1); const differenceWith = (arr, val, comp) => arr.filter(a => val.findIndex(b => comp(a, b)) === -1);
const dig = (obj, target) => const dig = (obj, target) =>
@ -344,8 +344,8 @@
const factorial = n => const factorial = n =>
n < 0 n < 0
? (() => { ? (() => {
throw new TypeError('Negative numbers are not allowed!'); throw new TypeError('Negative numbers are not allowed!');
})() })()
: n <= 1 : n <= 1
? 1 ? 1
: n * factorial(n - 1); : n * factorial(n - 1);
@ -991,9 +991,9 @@
const remove = (arr, func) => const remove = (arr, func) =>
Array.isArray(arr) Array.isArray(arr)
? arr.filter(func).reduce((acc, val) => { ? arr.filter(func).reduce((acc, val) => {
arr.splice(arr.indexOf(val), 1); arr.splice(arr.indexOf(val), 1);
return acc.concat(val); return acc.concat(val);
}, []) }, [])
: []; : [];
const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, ''); const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, '');
const renameKeys = (keysMap, obj) => const renameKeys = (keysMap, obj) =>

View File

@ -911,7 +911,7 @@
"archived": false "archived": false
}, },
"meta": { "meta": {
"hash": "92abc752f5d3a659467e3dde7a3890000f4b72d1fdfd66086092494b688506ae" "hash": "01f5f57c5b2663808e733b98e13dfd47d501ab010e681dd49219548816d1a3d0"
} }
}, },
{ {
@ -1162,7 +1162,7 @@
"archived": false "archived": false
}, },
"meta": { "meta": {
"hash": "383ed61e69b8f63ae42d0746a1995057f4f65b4af6ca7778d8f1771144802acd" "hash": "319e1a8fb41490965ee6e28db3e139e65c4ea5b7f43e332bc7216cd790e5d409"
} }
}, },
{ {
@ -3391,7 +3391,7 @@
"archived": false "archived": false
}, },
"meta": { "meta": {
"hash": "4815876fd6dbb17ad34c0d8918e7a72d837104f9beee7dc51b0fa73057b9e83e" "hash": "dcdf66e8d0eb4a1761c6b767b8cc350757087ae817ec371436faab0fff7c0051"
} }
}, },
{ {
@ -3763,7 +3763,7 @@
"archived": false "archived": false
}, },
"meta": { "meta": {
"hash": "ec9cb9384817f84cf0bacd62a23b69b2304fa2cf0352b16d3950b21d48c04f11" "hash": "2fd54c9fc1fb5b0a981df69501b518d5830ea77544d4d5290c7cc13745ca00ea"
} }
}, },
{ {

View File

@ -1331,11 +1331,11 @@
"type": "snippet", "type": "snippet",
"attributes": { "attributes": {
"fileName": "differenceBy.md", "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": { "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};", "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.filter(function (x) {\n return !s.has(fn(x));\n });\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.2]\ndifferenceBy([{ x: 2 }, { x: 1 }], [{ x: 1 }], v => v.x); // [ { x: 2 } ]" "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": [ "tags": [
"array", "array",
@ -1345,7 +1345,7 @@
}, },
"meta": { "meta": {
"archived": false, "archived": false,
"hash": "92abc752f5d3a659467e3dde7a3890000f4b72d1fdfd66086092494b688506ae" "hash": "01f5f57c5b2663808e733b98e13dfd47d501ab010e681dd49219548816d1a3d0"
} }
}, },
{ {
@ -1703,7 +1703,7 @@
"fileName": "factorial.md", "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.", "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": { "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};", "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" "example": "factorial(6); // 720"
}, },
@ -1715,7 +1715,7 @@
}, },
"meta": { "meta": {
"archived": false, "archived": false,
"hash": "383ed61e69b8f63ae42d0746a1995057f4f65b4af6ca7778d8f1771144802acd" "hash": "319e1a8fb41490965ee6e28db3e139e65c4ea5b7f43e332bc7216cd790e5d409"
} }
}, },
{ {
@ -4983,7 +4983,7 @@
"codeBlocks": { "codeBlocks": {
"es6": "const pipeAsyncFunctions = (...fns) => arg => fns.reduce((p, f) => p.then(f), Promise.resolve(arg));", "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};", "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": [ "tags": [
"adapter", "adapter",
@ -4994,7 +4994,7 @@
}, },
"meta": { "meta": {
"archived": false, "archived": false,
"hash": "4815876fd6dbb17ad34c0d8918e7a72d837104f9beee7dc51b0fa73057b9e83e" "hash": "dcdf66e8d0eb4a1761c6b767b8cc350757087ae817ec371436faab0fff7c0051"
} }
}, },
{ {
@ -5530,7 +5530,7 @@
"fileName": "remove.md", "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`).", "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": { "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};", "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]" "example": "remove([1, 2, 3, 4], n => n % 2 === 0); // [2, 4]"
}, },
@ -5541,7 +5541,7 @@
}, },
"meta": { "meta": {
"archived": false, "archived": false,
"hash": "ec9cb9384817f84cf0bacd62a23b69b2304fa2cf0352b16d3950b21d48c04f11" "hash": "2fd54c9fc1fb5b0a981df69501b518d5830ea77544d4d5290c7cc13745ca00ea"
} }
}, },
{ {

View File

@ -595,10 +595,10 @@
"body": [ "body": [
"const differenceBy = (a, b, fn) => {", "const differenceBy = (a, b, fn) => {",
" const s = new Set(b.map(fn));", " const s = new Set(b.map(fn));",
" return a.filter(x => !s.has(fn(x)));", " return a.map(fn).filter(el => !s.has(el));",
"};" "};"
], ],
"description": "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" "description": "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()"
}, },
"differenceWith": { "differenceWith": {
"prefix": "30s_differenceWith", "prefix": "30s_differenceWith",
@ -778,8 +778,8 @@
"const factorial = n =>", "const factorial = n =>",
" n < 0", " n < 0",
" ? (() => {", " ? (() => {",
" throw new TypeError('Negative numbers are not allowed!');", " throw new TypeError('Negative numbers are not allowed!');",
" })()", " })()",
" : n <= 1", " : n <= 1",
" ? 1", " ? 1",
" : n * factorial(n - 1);" " : n * factorial(n - 1);"
@ -2490,9 +2490,9 @@
"const remove = (arr, func) =>", "const remove = (arr, func) =>",
" Array.isArray(arr)", " Array.isArray(arr)",
" ? arr.filter(func).reduce((acc, val) => {", " ? arr.filter(func).reduce((acc, val) => {",
" arr.splice(arr.indexOf(val), 1);", " arr.splice(arr.indexOf(val), 1);",
" return acc.concat(val);", " return acc.concat(val);",
" }, [])", " }, [])",
" : [];" " : [];"
], ],
"description": "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`)" "description": "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`)"