Travis build: 1539

This commit is contained in:
30secondsofcode
2019-11-04 07:17:49 +00:00
parent e76a83f138
commit e5522dcf4c
15 changed files with 217 additions and 143 deletions

View File

@ -121,6 +121,7 @@ _30s.average(1, 2, 3);
* [`forEachRight`](#foreachright) * [`forEachRight`](#foreachright)
* [`groupBy`](#groupby) * [`groupBy`](#groupby)
* [`head`](#head) * [`head`](#head)
* [`includesAny`](#includesany)
* [`indexOfAll`](#indexofall) * [`indexOfAll`](#indexofall)
* [`initial`](#initial) * [`initial`](#initial)
* [`initialize2DArray`](#initialize2darray) * [`initialize2DArray`](#initialize2darray)
@ -678,7 +679,7 @@ const sum = pipeAsyncFunctions(
x => x + 3, x => x + 3,
async x => (await x) + 4 async x => (await x) + 4
); );
(async () => { (async() => {
console.log(await sum(5)); // 15 (after one second) console.log(await sum(5)); // 15 (after one second)
})(); })();
``` ```
@ -1450,6 +1451,27 @@ head([1, 2, 3]); // 1
<br>[⬆ Back to top](#contents) <br>[⬆ Back to top](#contents)
### includesAny
Returns `true` if at least one element of values is included in arr , `false` otherwise.
Use `Array.prototype.some()` and `Array.prototype.includes()` to check if at least one element of `values` is included in `arr`.
```js
const includesAny = (arr, values) => values.some(v => arr.includes(v));
```
<details>
<summary>Examples</summary>
```js
includesAny([1, 2, 3, 4], [2, 9]); // true
includesAny([1, 2, 3, 4], [8, 9]); // false
```
</details>
<br>[⬆ Back to top](#contents)
### indexOfAll ### indexOfAll
Returns all indices of `val` in an array. Returns all indices of `val` in an array.
@ -7128,11 +7150,14 @@ Return `false` beforehand if given key list is empty.
```js ```js
const hasKey = (obj, keys) => { const hasKey = (obj, keys) => {
return (keys.length > 0) && keys.every(key => { return (
keys.length > 0 &&
keys.every(key => {
if (typeof obj !== 'object' || !obj.hasOwnProperty(key)) return false; if (typeof obj !== 'object' || !obj.hasOwnProperty(key)) return false;
obj = obj[key]; obj = obj[key];
return true; return true;
}); })
);
}; };
``` ```

View File

@ -412,7 +412,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "f7e4d2f80cc19a12f09673c550b8c46dc33f615f3ab2c1bd6560781d9f5adde0" "hash": "a8be98f55b4e05039de14ef27f43e3816db032735e13ead686300dfd3e7a471f"
} }
}, },
{ {
@ -835,7 +835,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "5ab25ab96afd4f1f481fc318b5b290ba8c57a468ef6bca0ca200cfb7fcf3ba9f" "hash": "0a4684d6fc79bdbbac31df3af6c493ba7c881936ada5bc52824b4f26ca177459"
} }
}, },
{ {
@ -898,7 +898,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "7a228b650ff668f697e524e0d27ebeff1bfa35e04333b6cd5e742ff63bfea25d" "hash": "a4e1e33c0688dbf1ca231d9d8ea315ffed93b7f83f5d8cbf0714f10fdfeda8cf"
} }
}, },
{ {
@ -1037,7 +1037,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "5f38360819f9225b887a94221bfee1a80f1bcc224a364440b3388f60491b03ba" "hash": "484bd222e636e8a8409c30ddb1fe6e3fe72ab7a43f2edf089b2758d5e9bee528"
} }
}, },
{ {
@ -1273,7 +1273,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "55b1ce0a892110d792a9487e40331774015525479faa2b8961f6c2ea6291c27b" "hash": "0eac852db7a7add352b0d36677b22718b342ed9dc12f11780cac87e3b8260a05"
} }
}, },
{ {
@ -1678,7 +1678,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "16c3b724b653dcb31f3e59f1664a59951abb15a93eb3697cade4d3ae0e63c532" "hash": "9e39c6a3a8ec5b51c5e16f69107fc9e90b2697b2cf2689850872071bb968723e"
} }
}, },
{ {
@ -1854,7 +1854,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "d4a8563ed14c77123d07e9d3b206beea4a12bafdba9612c2afa04b3f87563b36" "hash": "a9b621f9cec178bc95756a18036042c4d4b884abecfd5599ba6df0f70759cded"
} }
}, },
{ {
@ -1970,6 +1970,21 @@
"hash": "542bc8c7cc17654b02dc9fdcd6791901f61a6907c89e42192f6e5d2a8eba41be" "hash": "542bc8c7cc17654b02dc9fdcd6791901f61a6907c89e42192f6e5d2a8eba41be"
} }
}, },
{
"id": "includesAny",
"type": "snippetListing",
"title": "includesAny",
"attributes": {
"text": "Returns `true` if at least one element of values is included in arr , `false` otherwise.\n\nUse `Array.prototype.some()` and `Array.prototype.includes()` to check if at least one element of `values` is included in `arr`.\n\n",
"tags": [
"array",
"beginner"
]
},
"meta": {
"hash": "8f19064ba89ab86c50456844646b56f6bd2afec2fc4f9ab3478bd6201510a745"
}
},
{ {
"id": "indentString", "id": "indentString",
"type": "snippetListing", "type": "snippetListing",
@ -2835,7 +2850,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "362fddaa6244404741e84bca6fc442a101fdb642af53b299e8b9994d0d7162d8" "hash": "3db3faac666ee61ab86c70766d2ab5d1293ffd818da87edb971bfff7a366364a"
} }
}, },
{ {
@ -3396,7 +3411,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "012ebca6a90c50ec89278af2632d7d0d90eeb423f2bcf902ed015f6fce6d4f5a" "hash": "23ded1eef634ad88b34431b187b5f9eca4432daf09e89980fb0661fb56d8dcb0"
} }
}, },
{ {
@ -3745,7 +3760,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "7ccbf66d8d55c60bcf12baa980cf32d67a4ba567894d59e2d798c9af792424ff" "hash": "17bcf3f13980b7f804d9f0fe274324b2a35ab7d479c03d77322dabba81e1a34a"
} }
}, },
{ {

View File

@ -568,7 +568,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "f7e4d2f80cc19a12f09673c550b8c46dc33f615f3ab2c1bd6560781d9f5adde0" "hash": "a8be98f55b4e05039de14ef27f43e3816db032735e13ead686300dfd3e7a471f"
} }
}, },
{ {
@ -1153,7 +1153,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "5ab25ab96afd4f1f481fc318b5b290ba8c57a468ef6bca0ca200cfb7fcf3ba9f" "hash": "0a4684d6fc79bdbbac31df3af6c493ba7c881936ada5bc52824b4f26ca177459"
} }
}, },
{ {
@ -1240,7 +1240,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "7a228b650ff668f697e524e0d27ebeff1bfa35e04333b6cd5e742ff63bfea25d" "hash": "a4e1e33c0688dbf1ca231d9d8ea315ffed93b7f83f5d8cbf0714f10fdfeda8cf"
} }
}, },
{ {
@ -1433,7 +1433,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "5f38360819f9225b887a94221bfee1a80f1bcc224a364440b3388f60491b03ba" "hash": "484bd222e636e8a8409c30ddb1fe6e3fe72ab7a43f2edf089b2758d5e9bee528"
} }
}, },
{ {
@ -1759,7 +1759,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "55b1ce0a892110d792a9487e40331774015525479faa2b8961f6c2ea6291c27b" "hash": "0eac852db7a7add352b0d36677b22718b342ed9dc12f11780cac87e3b8260a05"
} }
}, },
{ {
@ -2320,7 +2320,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "16c3b724b653dcb31f3e59f1664a59951abb15a93eb3697cade4d3ae0e63c532" "hash": "9e39c6a3a8ec5b51c5e16f69107fc9e90b2697b2cf2689850872071bb968723e"
} }
}, },
{ {
@ -2552,7 +2552,7 @@
"fileName": "hasKey.md", "fileName": "hasKey.md",
"text": "Returns `true` if the target value exists in a JSON object, `false` otherwise.\n\nCheck if `keys` is non-empty and use `Array.prototype.every()` to sequentially check its keys to internal depth of the object, `obj`. \nUse `Object.prototype.hasOwnProperty()` to check if `obj` does not have the current key or is not an object, stop propagation and return `false`.\nOtherwise assign the key's value to `obj` to use on the next iteration.\n\nReturn `false` beforehand if given key list is empty.\n\n", "text": "Returns `true` if the target value exists in a JSON object, `false` otherwise.\n\nCheck if `keys` is non-empty and use `Array.prototype.every()` to sequentially check its keys to internal depth of the object, `obj`. \nUse `Object.prototype.hasOwnProperty()` to check if `obj` does not have the current key or is not an object, stop propagation and return `false`.\nOtherwise assign the key's value to `obj` to use on the next iteration.\n\nReturn `false` beforehand if given key list is empty.\n\n",
"codeBlocks": { "codeBlocks": {
"es6": "const hasKey = (obj, keys) => {\n return (keys.length > 0) && keys.every(key => {\n if (typeof obj !== 'object' || !obj.hasOwnProperty(key)) return false;\n obj = obj[key];\n return true;\n });\n};", "es6": "const hasKey = (obj, keys) => {\n return (\n keys.length > 0 &&\n keys.every(key => {\n if (typeof obj !== 'object' || !obj.hasOwnProperty(key)) return false;\n obj = obj[key];\n return true;\n })\n );\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 hasKey = function hasKey(obj, keys) {\n return keys.length > 0 && keys.every(function (key) {\n if (_typeof(obj) !== 'object' || !obj.hasOwnProperty(key)) return false;\n obj = obj[key];\n return true;\n });\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 hasKey = function hasKey(obj, keys) {\n return keys.length > 0 && keys.every(function (key) {\n if (_typeof(obj) !== 'object' || !obj.hasOwnProperty(key)) return false;\n obj = obj[key];\n return true;\n });\n};",
"example": "let obj = {\n a: 1,\n b: { c: 4 },\n 'b.d': 5\n};\nhasKey(obj, ['a']); // true\nhasKey(obj, ['b']); // true\nhasKey(obj, ['b', 'c']); // true\nhasKey(obj, ['b.d']); // true\nhasKey(obj, ['d']); // false\nhasKey(obj, ['c']); // false\nhasKey(obj, ['b', 'f']); // false" "example": "let obj = {\n a: 1,\n b: { c: 4 },\n 'b.d': 5\n};\nhasKey(obj, ['a']); // true\nhasKey(obj, ['b']); // true\nhasKey(obj, ['b', 'c']); // true\nhasKey(obj, ['b.d']); // true\nhasKey(obj, ['d']); // false\nhasKey(obj, ['c']); // false\nhasKey(obj, ['b', 'f']); // false"
}, },
@ -2562,7 +2562,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "d4a8563ed14c77123d07e9d3b206beea4a12bafdba9612c2afa04b3f87563b36" "hash": "a9b621f9cec178bc95756a18036042c4d4b884abecfd5599ba6df0f70759cded"
} }
}, },
{ {
@ -2720,6 +2720,27 @@
"hash": "542bc8c7cc17654b02dc9fdcd6791901f61a6907c89e42192f6e5d2a8eba41be" "hash": "542bc8c7cc17654b02dc9fdcd6791901f61a6907c89e42192f6e5d2a8eba41be"
} }
}, },
{
"id": "includesAny",
"title": "includesAny",
"type": "snippet",
"attributes": {
"fileName": "includesAny.md",
"text": "Returns `true` if at least one element of values is included in arr , `false` otherwise.\n\nUse `Array.prototype.some()` and `Array.prototype.includes()` to check if at least one element of `values` is included in `arr`.\n\n",
"codeBlocks": {
"es6": "const includesAny = (arr, values) => values.some(v => arr.includes(v));",
"es5": "var includesAny = function includesAny(arr, values) {\n return values.some(function (v) {\n return arr.includes(v);\n });\n};",
"example": "includesAny([1, 2, 3, 4], [2, 9]); // true\nincludesAny([1, 2, 3, 4], [8, 9]); // false"
},
"tags": [
"array",
"beginner"
]
},
"meta": {
"hash": "8f19064ba89ab86c50456844646b56f6bd2afec2fc4f9ab3478bd6201510a745"
}
},
{ {
"id": "indentString", "id": "indentString",
"title": "indentString", "title": "indentString",
@ -3915,7 +3936,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "362fddaa6244404741e84bca6fc442a101fdb642af53b299e8b9994d0d7162d8" "hash": "3db3faac666ee61ab86c70766d2ab5d1293ffd818da87edb971bfff7a366364a"
} }
}, },
{ {
@ -4686,7 +4707,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "012ebca6a90c50ec89278af2632d7d0d90eeb423f2bcf902ed015f6fce6d4f5a" "hash": "23ded1eef634ad88b34431b187b5f9eca4432daf09e89980fb0661fb56d8dcb0"
} }
}, },
{ {
@ -5157,7 +5178,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",
@ -5167,7 +5188,7 @@
] ]
}, },
"meta": { "meta": {
"hash": "7ccbf66d8d55c60bcf12baa980cf32d67a4ba567894d59e2d798c9af792424ff" "hash": "17bcf3f13980b7f804d9f0fe274324b2a35ab7d479c03d77322dabba81e1a34a"
} }
}, },
{ {

View File

@ -35,6 +35,7 @@ const checkProp = (predicate, prop) => obj => !!predicate(obj[prop]);
const lengthIs4 = checkProp(l => l === 4, 'length'); const lengthIs4 = checkProp(l => l === 4, 'length');

View File

@ -11,7 +11,6 @@ Use `Object.assign()` and an empty object (`{}`) to create a shallow clone of th
Use `Object.keys()` and `Array.prototype.forEach()` to determine which key-value pairs need to be deep cloned. Use `Object.keys()` and `Array.prototype.forEach()` to determine which key-value pairs need to be deep cloned.
```js ```js
const deepClone = obj => { const deepClone = obj => {
if (obj === null) return null; if (obj === null) return null;
let clone = Object.assign({}, obj); let clone = Object.assign({}, obj);

View File

@ -10,7 +10,6 @@ Use `Object.keys(obj)` to iterate over the object's keys.
Use `Array.prototype.reduce()` to create a new object with the same values and mapped keys using `fn`. Use `Array.prototype.reduce()` to create a new object with the same values and mapped keys using `fn`.
```js ```js
const deepMapKeys = (obj, f) => const deepMapKeys = (obj, f) =>
Array.isArray(obj) Array.isArray(obj)
? obj.map(val => deepMapKeys(val, f)) ? obj.map(val => deepMapKeys(val, f))

View File

@ -9,7 +9,6 @@ Use the `in` operator to check if `target` exists in `obj`.
If 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. If 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.
```js ```js
const dig = (obj, target) => const dig = (obj, target) =>
target in obj target in obj
? obj[target] ? obj[target]

View File

@ -11,7 +11,6 @@ Otherwise, return the product of `n` and the factorial of `n - 1`.
Throws an exception if `n` is a negative number. Throws an exception if `n` is a negative number.
```js ```js
const factorial = n => const factorial = n =>
n < 0 n < 0
? (() => { ? (() => {

View File

@ -8,7 +8,6 @@ Converts an integer to a suffixed string, adding `am` or `pm` based on its value
Use the modulo operator (`%`) and conditional checks to transform an integer to a stringified 12-hour format with meridiem suffix. Use the modulo operator (`%`) and conditional checks to transform an integer to a stringified 12-hour format with meridiem suffix.
```js ```js
const getMeridiemSuffixOfInteger = num => const getMeridiemSuffixOfInteger = num =>
num === 0 || num === 24 num === 0 || num === 24
? 12 + 'am' ? 12 + 'am'

View File

@ -12,13 +12,15 @@ Otherwise assign the key's value to `obj` to use on the next iteration.
Return `false` beforehand if given key list is empty. Return `false` beforehand if given key list is empty.
```js ```js
const hasKey = (obj, keys) => { const hasKey = (obj, keys) => {
return (keys.length > 0) && keys.every(key => { return (
keys.length > 0 &&
keys.every(key => {
if (typeof obj !== 'object' || !obj.hasOwnProperty(key)) return false; if (typeof obj !== 'object' || !obj.hasOwnProperty(key)) return false;
obj = obj[key]; obj = obj[key];
return true; return true;
}); })
);
}; };
``` ```

View File

@ -11,7 +11,6 @@ Omit the second argument, `separator`, to use a default separator of `','`.
Omit the third argument, `end`, to use the same value as `separator` by default. Omit the third argument, `end`, to use the same value as `separator` by default.
```js ```js
const join = (arr, separator = ',', end = separator) => const join = (arr, separator = ',', end = separator) =>
arr.reduce( arr.reduce(
(acc, val, i) => (acc, val, i) =>

View File

@ -10,6 +10,7 @@ Determine the `symbol` to be either `?` or `&` based on the `index` and concaten
Return the `queryString` or an empty string when the `queryParameters` are falsy. Return the `queryString` or an empty string when the `queryParameters` are falsy.
```js ```js
const objectToQueryString = queryParameters => { const objectToQueryString = queryParameters => {
return queryParameters return queryParameters
? Object.entries(queryParameters).reduce((queryString, [key, val], index) => { ? Object.entries(queryParameters).reduce((queryString, [key, val], index) => {

View File

@ -14,13 +14,14 @@ const pipeAsyncFunctions = (...fns) => arg => fns.reduce((p, f) => p.then(f), Pr
``` ```
```js ```js
const sum = pipeAsyncFunctions( const sum = pipeAsyncFunctions(
x => x + 1, x => x + 1,
x => new Promise(resolve => setTimeout(() => resolve(x + 2), 1000)), x => new Promise(resolve => setTimeout(() => resolve(x + 2), 1000)),
x => x + 3, x => x + 3,
async x => (await x) + 4 async x => (await x) + 4
); );
(async () => { (async() => {
console.log(await sum(5)); // 15 (after one second) console.log(await sum(5)); // 15 (after one second)
})(); })();
``` ```

View File

@ -467,11 +467,14 @@ const hashNode = val =>
) )
); );
const hasKey = (obj, keys) => { const hasKey = (obj, keys) => {
return (keys.length > 0) && keys.every(key => { return (
keys.length > 0 &&
keys.every(key => {
if (typeof obj !== 'object' || !obj.hasOwnProperty(key)) return false; if (typeof obj !== 'object' || !obj.hasOwnProperty(key)) return false;
obj = obj[key]; obj = obj[key];
return true; return true;
}); })
);
}; };
const head = arr => arr[0]; const head = arr => arr[0];
const hexToRGB = hex => { const hexToRGB = hex => {
@ -517,6 +520,7 @@ const hz = (fn, iterations = 100) => {
for (let i = 0; i < iterations; i++) fn(); for (let i = 0; i < iterations; i++) fn();
return (1000 * iterations) / (performance.now() - before); return (1000 * iterations) / (performance.now() - before);
}; };
const includesAny = (arr, values) => values.some(v => arr.includes(v));
const indentString = (str, count, indent = ' ') => str.replace(/^/gm, indent.repeat(count)); const indentString = (str, count, indent = ' ') => str.replace(/^/gm, indent.repeat(count));
const indexOfAll = (arr, val) => arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []); const indexOfAll = (arr, val) => arr.reduce((acc, el, i) => (el === val ? [...acc, i] : acc), []);
const initial = arr => arr.slice(0, -1); const initial = arr => arr.slice(0, -1);
@ -1561,4 +1565,4 @@ const speechSynthesis = message => {
const squareSum = (...args) => args.reduce((squareSum, number) => squareSum + Math.pow(number, 2), 0); const squareSum = (...args) => args.reduce((squareSum, number) => squareSum + Math.pow(number, 2), 0);
module.exports = {all,allEqual,any,approximatelyEqual,arrayToCSV,arrayToHtmlList,ary,atob,attempt,average,averageBy,bifurcate,bifurcateBy,bind,bindAll,bindKey,binomialCoefficient,bottomVisible,btoa,byteSize,call,capitalize,capitalizeEveryWord,castArray,chainAsync,checkProp,chunk,clampNumber,cloneRegExp,coalesce,coalesceFactory,collectInto,colorize,compact,compactWhitespace,compose,composeRight,converge,copyToClipboard,countBy,counter,countOccurrences,createDirIfNotExists,createElement,createEventHub,CSVToArray,CSVToJSON,currentURL,curry,dayOfYear,debounce,decapitalize,deepClone,deepFlatten,deepFreeze,deepGet,deepMapKeys,defaults,defer,degreesToRads,delay,detectDeviceType,difference,differenceBy,differenceWith,dig,digitize,distance,drop,dropRight,dropRightWhile,dropWhile,elementContains,elementIsVisibleInViewport,elo,equals,escapeHTML,escapeRegExp,everyNth,extendHex,factorial,fibonacci,filterFalsy,filterNonUnique,filterNonUniqueBy,findKey,findLast,findLastIndex,findLastKey,flatten,flattenObject,flip,forEachRight,formatDuration,formToObject,forOwn,forOwnRight,fromCamelCase,functionName,functions,gcd,geometricProgression,get,getColonTimeFromDate,getDaysDiffBetweenDates,getImages,getMeridiemSuffixOfInteger,getScrollPosition,getStyle,getType,getURLParameters,groupBy,hammingDistance,hasClass,hasFlags,hashBrowser,hashNode,hasKey,head,hexToRGB,hide,httpGet,httpPost,httpsRedirect,hz,indentString,indexOfAll,initial,initialize2DArray,initializeArrayWithRange,initializeArrayWithRangeRight,initializeArrayWithValues,initializeNDArray,inRange,insertAfter,insertBefore,intersection,intersectionBy,intersectionWith,invertKeyValues,is,isAbsoluteURL,isAfterDate,isAnagram,isArrayLike,isBeforeDate,isBoolean,isBrowser,isBrowserTabFocused,isDivisible,isDuplexStream,isEmpty,isEven,isFunction,isLowerCase,isNegativeZero,isNil,isNull,isNumber,isObject,isObjectLike,isOdd,isPlainObject,isPrime,isPrimitive,isPromiseLike,isReadableStream,isSameDate,isSorted,isStream,isString,isSymbol,isTravisCI,isUndefined,isUpperCase,isValidJSON,isWeekday,isWeekend,isWritableStream,join,JSONtoCSV,JSONToFile,last,lcm,longestItem,lowercaseKeys,luhnCheck,mapKeys,mapNumRange,mapObject,mapString,mapValues,mask,matches,matchesWith,maxBy,maxDate,maxN,median,memoize,merge,midpoint,minBy,minDate,minN,mostPerformant,negate,nest,nodeListToArray,none,nthArg,nthElement,objectFromPairs,objectToPairs,objectToQueryString,observeMutations,off,offset,omit,omitBy,on,once,onUserInputChange,orderBy,over,overArgs,pad,palindrome,parseCookie,partial,partialRight,partition,percentile,permutations,pick,pickBy,pipeAsyncFunctions,pipeFunctions,pluralize,powerset,prefix,prettyBytes,primes,promisify,pull,pullAtIndex,pullAtValue,pullBy,radsToDegrees,randomHexColorCode,randomIntArrayInRange,randomIntegerInRange,randomNumberInRange,readFileLines,rearg,recordAnimationFrames,redirect,reducedFilter,reduceSuccessive,reduceWhich,reject,remove,removeNonASCII,renameKeys,reverseString,RGBToHex,round,runAsync,runPromisesInSeries,sample,sampleSize,scrollToTop,sdbm,serializeCookie,serializeForm,setStyle,shallowClone,shank,show,shuffle,similarity,size,sleep,smoothScroll,sortCharactersInString,sortedIndex,sortedIndexBy,sortedLastIndex,sortedLastIndexBy,splitLines,spreadOver,stableSort,standardDeviation,stringPermutations,stripHTMLTags,sum,sumBy,sumPower,symmetricDifference,symmetricDifferenceBy,symmetricDifferenceWith,tail,take,takeRight,takeRightWhile,takeWhile,throttle,times,timeTaken,toCamelCase,toCurrency,toDecimalMark,toggleClass,toHash,toKebabCase,tomorrow,toOrdinalSuffix,toSafeInteger,toSnakeCase,toTitleCase,transform,triggerEvent,truncateString,truthCheckCollection,unary,uncurry,unescapeHTML,unflattenObject,unfold,union,unionBy,unionWith,uniqueElements,uniqueElementsBy,uniqueElementsByRight,uniqueSymmetricDifference,untildify,unzip,unzipWith,URLJoin,UUIDGeneratorBrowser,UUIDGeneratorNode,validateNumber,vectorDistance,when,without,words,xProd,yesNo,yesterday,zip,zipObject,zipWith,binarySearch,celsiusToFahrenheit,cleanObj,collatz,countVowels,factors,fahrenheitToCelsius,fibonacciCountUntilNum,fibonacciUntilNum,heronArea,howManyTimes,httpDelete,httpPut,isArmstrongNumber,isSimilar,JSONToDate,kmphToMph,levenshteinDistance,mphToKmph,pipeLog,quickSort,removeVowels,solveRPN,speechSynthesis,squareSum} module.exports = {all,allEqual,any,approximatelyEqual,arrayToCSV,arrayToHtmlList,ary,atob,attempt,average,averageBy,bifurcate,bifurcateBy,bind,bindAll,bindKey,binomialCoefficient,bottomVisible,btoa,byteSize,call,capitalize,capitalizeEveryWord,castArray,chainAsync,checkProp,chunk,clampNumber,cloneRegExp,coalesce,coalesceFactory,collectInto,colorize,compact,compactWhitespace,compose,composeRight,converge,copyToClipboard,countBy,counter,countOccurrences,createDirIfNotExists,createElement,createEventHub,CSVToArray,CSVToJSON,currentURL,curry,dayOfYear,debounce,decapitalize,deepClone,deepFlatten,deepFreeze,deepGet,deepMapKeys,defaults,defer,degreesToRads,delay,detectDeviceType,difference,differenceBy,differenceWith,dig,digitize,distance,drop,dropRight,dropRightWhile,dropWhile,elementContains,elementIsVisibleInViewport,elo,equals,escapeHTML,escapeRegExp,everyNth,extendHex,factorial,fibonacci,filterFalsy,filterNonUnique,filterNonUniqueBy,findKey,findLast,findLastIndex,findLastKey,flatten,flattenObject,flip,forEachRight,formatDuration,formToObject,forOwn,forOwnRight,fromCamelCase,functionName,functions,gcd,geometricProgression,get,getColonTimeFromDate,getDaysDiffBetweenDates,getImages,getMeridiemSuffixOfInteger,getScrollPosition,getStyle,getType,getURLParameters,groupBy,hammingDistance,hasClass,hasFlags,hashBrowser,hashNode,hasKey,head,hexToRGB,hide,httpGet,httpPost,httpsRedirect,hz,includesAny,indentString,indexOfAll,initial,initialize2DArray,initializeArrayWithRange,initializeArrayWithRangeRight,initializeArrayWithValues,initializeNDArray,inRange,insertAfter,insertBefore,intersection,intersectionBy,intersectionWith,invertKeyValues,is,isAbsoluteURL,isAfterDate,isAnagram,isArrayLike,isBeforeDate,isBoolean,isBrowser,isBrowserTabFocused,isDivisible,isDuplexStream,isEmpty,isEven,isFunction,isLowerCase,isNegativeZero,isNil,isNull,isNumber,isObject,isObjectLike,isOdd,isPlainObject,isPrime,isPrimitive,isPromiseLike,isReadableStream,isSameDate,isSorted,isStream,isString,isSymbol,isTravisCI,isUndefined,isUpperCase,isValidJSON,isWeekday,isWeekend,isWritableStream,join,JSONtoCSV,JSONToFile,last,lcm,longestItem,lowercaseKeys,luhnCheck,mapKeys,mapNumRange,mapObject,mapString,mapValues,mask,matches,matchesWith,maxBy,maxDate,maxN,median,memoize,merge,midpoint,minBy,minDate,minN,mostPerformant,negate,nest,nodeListToArray,none,nthArg,nthElement,objectFromPairs,objectToPairs,objectToQueryString,observeMutations,off,offset,omit,omitBy,on,once,onUserInputChange,orderBy,over,overArgs,pad,palindrome,parseCookie,partial,partialRight,partition,percentile,permutations,pick,pickBy,pipeAsyncFunctions,pipeFunctions,pluralize,powerset,prefix,prettyBytes,primes,promisify,pull,pullAtIndex,pullAtValue,pullBy,radsToDegrees,randomHexColorCode,randomIntArrayInRange,randomIntegerInRange,randomNumberInRange,readFileLines,rearg,recordAnimationFrames,redirect,reducedFilter,reduceSuccessive,reduceWhich,reject,remove,removeNonASCII,renameKeys,reverseString,RGBToHex,round,runAsync,runPromisesInSeries,sample,sampleSize,scrollToTop,sdbm,serializeCookie,serializeForm,setStyle,shallowClone,shank,show,shuffle,similarity,size,sleep,smoothScroll,sortCharactersInString,sortedIndex,sortedIndexBy,sortedLastIndex,sortedLastIndexBy,splitLines,spreadOver,stableSort,standardDeviation,stringPermutations,stripHTMLTags,sum,sumBy,sumPower,symmetricDifference,symmetricDifferenceBy,symmetricDifferenceWith,tail,take,takeRight,takeRightWhile,takeWhile,throttle,times,timeTaken,toCamelCase,toCurrency,toDecimalMark,toggleClass,toHash,toKebabCase,tomorrow,toOrdinalSuffix,toSafeInteger,toSnakeCase,toTitleCase,transform,triggerEvent,truncateString,truthCheckCollection,unary,uncurry,unescapeHTML,unflattenObject,unfold,union,unionBy,unionWith,uniqueElements,uniqueElementsBy,uniqueElementsByRight,uniqueSymmetricDifference,untildify,unzip,unzipWith,URLJoin,UUIDGeneratorBrowser,UUIDGeneratorNode,validateNumber,vectorDistance,when,without,words,xProd,yesNo,yesterday,zip,zipObject,zipWith,binarySearch,celsiusToFahrenheit,cleanObj,collatz,countVowels,factors,fahrenheitToCelsius,fibonacciCountUntilNum,fibonacciUntilNum,heronArea,howManyTimes,httpDelete,httpPut,isArmstrongNumber,isSimilar,JSONToDate,kmphToMph,levenshteinDistance,mphToKmph,pipeLog,quickSort,removeVowels,solveRPN,speechSynthesis,squareSum}

View File

@ -1170,11 +1170,14 @@
"prefix": "30s_hasKey", "prefix": "30s_hasKey",
"body": [ "body": [
"const hasKey = (obj, keys) => {", "const hasKey = (obj, keys) => {",
" return (keys.length > 0) && keys.every(key => {", " return (",
" keys.length > 0 &&",
" keys.every(key => {",
" if (typeof obj !== 'object' || !obj.hasOwnProperty(key)) return false;", " if (typeof obj !== 'object' || !obj.hasOwnProperty(key)) return false;",
" obj = obj[key];", " obj = obj[key];",
" return true;", " return true;",
" });", " })",
" );",
"};" "};"
], ],
"description": "Returns `true` if the target value exists in a JSON object, `false` otherwise.\n\nCheck if `keys` is non-empty and use `Array.prototype.every()` to sequentially check its keys to internal depth of the object, `obj`. \nUse `Object.prototype.hasOwnProperty()` to check if `obj` does not have the current key or is not an object, stop propagation and return `false`.\nOtherwise assign the key's value to `obj` to use on the next iteration.\n\nReturn `false` beforehand if given key list is empty.\n" "description": "Returns `true` if the target value exists in a JSON object, `false` otherwise.\n\nCheck if `keys` is non-empty and use `Array.prototype.every()` to sequentially check its keys to internal depth of the object, `obj`. \nUse `Object.prototype.hasOwnProperty()` to check if `obj` does not have the current key or is not an object, stop propagation and return `false`.\nOtherwise assign the key's value to `obj` to use on the next iteration.\n\nReturn `false` beforehand if given key list is empty.\n"
@ -1265,6 +1268,13 @@
], ],
"description": "Returns the number of times a function executed per second. \n`hz` is the unit for `hertz`, the unit of frequency defined as one cycle per second.\n\nUse `performance.now()` to get the difference in milliseconds before and after the iteration loop to calculate the time elapsed executing the function `iterations` times. \nReturn the number of cycles per second by converting milliseconds to seconds and dividing it by the time elapsed. \nOmit the second argument, `iterations`, to use the default of 100 iterations.\n" "description": "Returns the number of times a function executed per second. \n`hz` is the unit for `hertz`, the unit of frequency defined as one cycle per second.\n\nUse `performance.now()` to get the difference in milliseconds before and after the iteration loop to calculate the time elapsed executing the function `iterations` times. \nReturn the number of cycles per second by converting milliseconds to seconds and dividing it by the time elapsed. \nOmit the second argument, `iterations`, to use the default of 100 iterations.\n"
}, },
"includesAny": {
"prefix": "30s_includesAny",
"body": [
"const includesAny = (arr, values) => values.some(v => arr.includes(v));"
],
"description": "Returns `true` if at least one element of values is included in arr , `false` otherwise.\n\nUse `Array.prototype.some()` and `Array.prototype.includes()` to check if at least one element of `values` is included in `arr`.\n"
},
"indentString": { "indentString": {
"prefix": "30s_indentString", "prefix": "30s_indentString",
"body": [ "body": [