Travis build: 1186 [cron]

This commit is contained in:
30secondsofcode
2019-05-31 15:56:16 +00:00
parent b97f9baf34
commit 6b59c51655
5 changed files with 23 additions and 23 deletions

10
dist/_30s.esm.js vendored
View File

@ -269,9 +269,9 @@ const dig = (obj, target) =>
target in obj target in obj
? obj[target] ? obj[target]
: Object.values(obj).reduce((acc, val) => { : Object.values(obj).reduce((acc, val) => {
if (acc !== undefined) return acc; if (acc !== undefined) return acc;
if (typeof val === 'object') return dig(val, target); if (typeof val === 'object') return dig(val, target);
}, undefined); }, undefined);
const digitize = n => [...`${n}`].map(i => parseInt(i)); const digitize = n => [...`${n}`].map(i => parseInt(i));
const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0); const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0);
const drop = (arr, n = 1) => arr.slice(n); const drop = (arr, n = 1) => arr.slice(n);
@ -344,8 +344,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);

10
dist/_30s.js vendored
View File

@ -275,9 +275,9 @@
target in obj target in obj
? obj[target] ? obj[target]
: Object.values(obj).reduce((acc, val) => { : Object.values(obj).reduce((acc, val) => {
if (acc !== undefined) return acc; if (acc !== undefined) return acc;
if (typeof val === 'object') return dig(val, target); if (typeof val === 'object') return dig(val, target);
}, undefined); }, undefined);
const digitize = n => [...`${n}`].map(i => parseInt(i)); const digitize = n => [...`${n}`].map(i => parseInt(i));
const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0); const distance = (x0, y0, x1, y1) => Math.hypot(x1 - x0, y1 - y0);
const drop = (arr, n = 1) => arr.slice(n); const drop = (arr, n = 1) => arr.slice(n);
@ -350,8 +350,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);

View File

@ -386,7 +386,7 @@
"archived": false "archived": false
}, },
"meta": { "meta": {
"hash": "f6aaee6ddb2ff7884f5bc5b5d37d1def44b549c3b260f4522ab812f5d163996c" "hash": "3c8137c4ad86cf334aca583fd69bd3859ebc05defcd6ada7c35c876541195818"
} }
}, },
{ {
@ -971,7 +971,7 @@
"archived": false "archived": false
}, },
"meta": { "meta": {
"hash": "828a6f2f3b94cc537ef0ee30c5ebda28fff688fea65030e47d5721831bdb48ce" "hash": "f982b4e8e3ec3c8b0c2ef4f19b38dac90df6ebe2dd4daa0126c917ebc07d3e62"
} }
}, },
{ {
@ -1192,7 +1192,7 @@
"archived": false "archived": false
}, },
"meta": { "meta": {
"hash": "383ed61e69b8f63ae42d0746a1995057f4f65b4af6ca7778d8f1771144802acd" "hash": "319e1a8fb41490965ee6e28db3e139e65c4ea5b7f43e332bc7216cd790e5d409"
} }
}, },
{ {

View File

@ -568,7 +568,7 @@
}, },
"meta": { "meta": {
"archived": false, "archived": false,
"hash": "f6aaee6ddb2ff7884f5bc5b5d37d1def44b549c3b260f4522ab812f5d163996c" "hash": "3c8137c4ad86cf334aca583fd69bd3859ebc05defcd6ada7c35c876541195818"
} }
}, },
{ {
@ -1421,7 +1421,7 @@
"fileName": "dig.md", "fileName": "dig.md",
"text": "Returns the target value in a nested JSON object, based on the given key.\n\nUse the `in` operator to check if `target` exists in `obj`.\nIf found, return the value of `obj[target]`, otherwise use `Object.values(obj)` and `Array.prototype.reduce()` to recursively call `dig` on each nested object until the first matching key/value pair is found.", "text": "Returns the target value in a nested JSON object, based on the given key.\n\nUse the `in` operator to check if `target` exists in `obj`.\nIf found, return the value of `obj[target]`, otherwise use `Object.values(obj)` and `Array.prototype.reduce()` to recursively call `dig` on each nested object until the first matching key/value pair is found.",
"codeBlocks": { "codeBlocks": {
"es6": "const dig = (obj, target) =>\n target in obj\n ? obj[target]\n : Object.values(obj).reduce((acc, val) => {\n if (acc !== undefined) return acc;\n if (typeof val === 'object') return dig(val, target);\n }, undefined);", "es6": "const dig = (obj, target) =>\n target in obj\n ? obj[target]\n : Object.values(obj).reduce((acc, val) => {\n if (acc !== undefined) return acc;\n if (typeof val === 'object') return dig(val, target);\n }, undefined);",
"es5": "function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar dig = function dig(obj, target) {\n return target in obj ? obj[target] : Object.values(obj).reduce(function (acc, val) {\n if (acc !== undefined) return acc;\n if (_typeof(val) === 'object') return dig(val, target);\n }, undefined);\n};", "es5": "function _typeof(obj) { if (typeof Symbol === \"function\" && typeof Symbol.iterator === \"symbol\") { _typeof = function _typeof(obj) { return typeof obj; }; } else { _typeof = function _typeof(obj) { return obj && typeof Symbol === \"function\" && obj.constructor === Symbol && obj !== Symbol.prototype ? \"symbol\" : typeof obj; }; } return _typeof(obj); }\n\nvar dig = function dig(obj, target) {\n return target in obj ? obj[target] : Object.values(obj).reduce(function (acc, val) {\n if (acc !== undefined) return acc;\n if (_typeof(val) === 'object') return dig(val, target);\n }, undefined);\n};",
"example": "const data = {\n level1: {\n level2: {\n level3: 'some data'\n }\n }\n};\ndig(data, 'level3'); // 'some data'\ndig(data, 'level4'); // undefined" "example": "const data = {\n level1: {\n level2: {\n level3: 'some data'\n }\n }\n};\ndig(data, 'level3'); // 'some data'\ndig(data, 'level4'); // undefined"
}, },
@ -1433,7 +1433,7 @@
}, },
"meta": { "meta": {
"archived": false, "archived": false,
"hash": "828a6f2f3b94cc537ef0ee30c5ebda28fff688fea65030e47d5721831bdb48ce" "hash": "f982b4e8e3ec3c8b0c2ef4f19b38dac90df6ebe2dd4daa0126c917ebc07d3e62"
} }
}, },
{ {
@ -1747,7 +1747,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"
}, },
@ -1759,7 +1759,7 @@
}, },
"meta": { "meta": {
"archived": false, "archived": false,
"hash": "383ed61e69b8f63ae42d0746a1995057f4f65b4af6ca7778d8f1771144802acd" "hash": "319e1a8fb41490965ee6e28db3e139e65c4ea5b7f43e332bc7216cd790e5d409"
} }
}, },
{ {

View File

@ -631,9 +631,9 @@
" target in obj", " target in obj",
" ? obj[target]", " ? obj[target]",
" : Object.values(obj).reduce((acc, val) => {", " : Object.values(obj).reduce((acc, val) => {",
" if (acc !== undefined) return acc;", " if (acc !== undefined) return acc;",
" if (typeof val === 'object') return dig(val, target);", " if (typeof val === 'object') return dig(val, target);",
" }, undefined);" " }, undefined);"
], ],
"description": "Returns the target value in a nested JSON object, based on the given key.\n\nUse the `in` operator to check if `target` exists in `obj`.\nIf found, return the value of `obj[target]`, otherwise use `Object.values(obj)` and `Array.prototype.reduce()` to recursively call `dig` on each nested object until the first matching key/value pair is found" "description": "Returns the target value in a nested JSON object, based on the given key.\n\nUse the `in` operator to check if `target` exists in `obj`.\nIf found, return the value of `obj[target]`, otherwise use `Object.values(obj)` and `Array.prototype.reduce()` to recursively call `dig` on each nested object until the first matching key/value pair is found"
}, },
@ -796,8 +796,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);"