Travis build: 1682
This commit is contained in:
@ -1871,6 +1871,21 @@
|
|||||||
"hash": "09664f8ede4cc568302d52fe37d3a29dc6c4b052e76834e761a02c391178f33a"
|
"hash": "09664f8ede4cc568302d52fe37d3a29dc6c4b052e76834e761a02c391178f33a"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "haveSameContents",
|
||||||
|
"type": "snippetListing",
|
||||||
|
"title": "haveSameContents",
|
||||||
|
"attributes": {
|
||||||
|
"text": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n\n",
|
||||||
|
"tags": [
|
||||||
|
"array",
|
||||||
|
"intermediate"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"hash": "917079b8a868588894ebbd8d76a1bf5359d91d09dce294d7bb2cc0185900a2ae"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "head",
|
"id": "head",
|
||||||
"type": "snippetListing",
|
"type": "snippetListing",
|
||||||
@ -2393,6 +2408,21 @@
|
|||||||
"hash": "3aab66b09df0070568e0ff69717ac0d5c62d88727262419d07b0f50e1a6677e4"
|
"hash": "3aab66b09df0070568e0ff69717ac0d5c62d88727262419d07b0f50e1a6677e4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "isContainedIn",
|
||||||
|
"type": "snippetListing",
|
||||||
|
"title": "isContainedIn",
|
||||||
|
"attributes": {
|
||||||
|
"text": "Returns `true` if the elements of the first array are contained in the second one regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the first array.\nUse `Array.prototype.some()` to check if all distinct values are contained in the second array, use `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.\nReturn `false` if the count of any element is greater in the first array than the second one, `true` otherwise.\n\n",
|
||||||
|
"tags": [
|
||||||
|
"array",
|
||||||
|
"intermediate"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"hash": "b89ab73ffc7dd9b7650e80eb41a20194dfee6f93740876349b6af91dccc6ecd3"
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "isDivisible",
|
"id": "isDivisible",
|
||||||
"type": "snippetListing",
|
"type": "snippetListing",
|
||||||
@ -2894,7 +2924,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "682a6b7cfeb58efe9ed7b6daf467c45397df0acecfc21cab59e5ffedd03503ba"
|
"hash": "3db3faac666ee61ab86c70766d2ab5d1293ffd818da87edb971bfff7a366364a"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -3470,7 +3500,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "b031c3387ef66411ab5d295788eac4247ada5b4b068dda90603d3c973890bc26"
|
"hash": "e8f820ce6da97eabde082ffb829c9fb700e85efc79bdebe883c67237269e3f52"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -3819,7 +3849,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "17bcf3f13980b7f804d9f0fe274324b2a35ab7d479c03d77322dabba81e1a34a"
|
"hash": "7ccbf66d8d55c60bcf12baa980cf32d67a4ba567894d59e2d798c9af792424ff"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -4216,7 +4246,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "069472d018c3102412dafc2ae8ec6e9396e53c01d0073079f2e3f1ac3c99b6e9"
|
"hash": "c1542907e6295eb81df918174c247a65d73c8daccc56769f2eb32d609b7846fc"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -4532,7 +4562,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "24b93b68a59b49f245590930fed6fb82e286ce09f90e292466cde63c1784c347"
|
"hash": "6dd4c6a51d2c80fa4768c95ae01c16a8359c4140bcad28c7fde0cecd72d7d3e2"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -2518,9 +2518,9 @@
|
|||||||
"meta": {
|
"meta": {
|
||||||
"hash": "227fc1043f5a7850c32f4ecce686a97de0b8badf4d487462a1c25e8312465124",
|
"hash": "227fc1043f5a7850c32f4ecce686a97de0b8badf4d487462a1c25e8312465124",
|
||||||
"firstSeen": "1578058355",
|
"firstSeen": "1578058355",
|
||||||
"lastUpdated": "1578058355",
|
"lastUpdated": "1578058637",
|
||||||
"updateCount": 2,
|
"updateCount": 3,
|
||||||
"authorCount": 2
|
"authorCount": 3
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -3061,6 +3061,31 @@
|
|||||||
"authorCount": 4
|
"authorCount": 4
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "haveSameContents",
|
||||||
|
"title": "haveSameContents",
|
||||||
|
"type": "snippet",
|
||||||
|
"attributes": {
|
||||||
|
"fileName": "haveSameContents.md",
|
||||||
|
"text": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n\n",
|
||||||
|
"codeBlocks": {
|
||||||
|
"es6": "const haveSameContents = (a, b) => {\n for (const v of new Set([...a, ...b]))\n if (a.filter(e => e === v).length !== b.filter(e => e === v).length) return false;\n return true;\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\nfunction _toConsumableArray(arr) { return _arrayWithoutHoles(arr) || _iterableToArray(arr) || _nonIterableSpread(); }\n\nfunction _nonIterableSpread() { throw new TypeError(\"Invalid attempt to spread non-iterable instance\"); }\n\nfunction _iterableToArray(iter) { if (Symbol.iterator in Object(iter) || Object.prototype.toString.call(iter) === \"[object Arguments]\") return Array.from(iter); }\n\nfunction _arrayWithoutHoles(arr) { if (Array.isArray(arr)) { for (var i = 0, arr2 = new Array(arr.length); i < arr.length; i++) { arr2[i] = arr[i]; } return arr2; } }\n\nvar haveSameContents = function haveSameContents(a, b) {\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n var _loop = function _loop() {\n var v = _step.value;\n if (a.filter(function (e) {\n return e === v;\n }).length !== b.filter(function (e) {\n return e === v;\n }).length) return {\n v: false\n };\n };\n\n for (var _iterator = new Set([].concat(_toConsumableArray(a), _toConsumableArray(b)))[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var _ret = _loop();\n\n if (_typeof(_ret) === \"object\") return _ret.v;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n _iterator[\"return\"]();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return true;\n};",
|
||||||
|
"example": "haveSameContents([1, 2, 4], [2, 4, 1]); // true"
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"array",
|
||||||
|
"intermediate"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"hash": "917079b8a868588894ebbd8d76a1bf5359d91d09dce294d7bb2cc0185900a2ae",
|
||||||
|
"firstSeen": "1578253239",
|
||||||
|
"lastUpdated": "1578253239",
|
||||||
|
"updateCount": 2,
|
||||||
|
"authorCount": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "head",
|
"id": "head",
|
||||||
"title": "head",
|
"title": "head",
|
||||||
@ -3913,6 +3938,31 @@
|
|||||||
"authorCount": 2
|
"authorCount": 2
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
{
|
||||||
|
"id": "isContainedIn",
|
||||||
|
"title": "isContainedIn",
|
||||||
|
"type": "snippet",
|
||||||
|
"attributes": {
|
||||||
|
"fileName": "isContainedIn.md",
|
||||||
|
"text": "Returns `true` if the elements of the first array are contained in the second one regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the first array.\nUse `Array.prototype.some()` to check if all distinct values are contained in the second array, use `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.\nReturn `false` if the count of any element is greater in the first array than the second one, `true` otherwise.\n\n",
|
||||||
|
"codeBlocks": {
|
||||||
|
"es6": "const isContainedIn = (a, b) => {\n for (const v of new Set(a)) {\n if (\n !b.some(e => e === v) ||\n a.filter(e => e === v).length > b.filter(e => e === v).length\n )\n return false;\n }\n return true;\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 isContainedIn = function isContainedIn(a, b) {\n var _iteratorNormalCompletion = true;\n var _didIteratorError = false;\n var _iteratorError = undefined;\n\n try {\n var _loop = function _loop() {\n var v = _step.value;\n if (!b.some(function (e) {\n return e === v;\n }) || a.filter(function (e) {\n return e === v;\n }).length > b.filter(function (e) {\n return e === v;\n }).length) return {\n v: false\n };\n };\n\n for (var _iterator = new Set(a)[Symbol.iterator](), _step; !(_iteratorNormalCompletion = (_step = _iterator.next()).done); _iteratorNormalCompletion = true) {\n var _ret = _loop();\n\n if (_typeof(_ret) === \"object\") return _ret.v;\n }\n } catch (err) {\n _didIteratorError = true;\n _iteratorError = err;\n } finally {\n try {\n if (!_iteratorNormalCompletion && _iterator[\"return\"] != null) {\n _iterator[\"return\"]();\n }\n } finally {\n if (_didIteratorError) {\n throw _iteratorError;\n }\n }\n }\n\n return true;\n};",
|
||||||
|
"example": "isContainedIn([1, 4], [2, 4, 1]); // true"
|
||||||
|
},
|
||||||
|
"tags": [
|
||||||
|
"array",
|
||||||
|
"intermediate"
|
||||||
|
]
|
||||||
|
},
|
||||||
|
"meta": {
|
||||||
|
"hash": "b89ab73ffc7dd9b7650e80eb41a20194dfee6f93740876349b6af91dccc6ecd3",
|
||||||
|
"firstSeen": "1578253251",
|
||||||
|
"lastUpdated": "1578253251",
|
||||||
|
"updateCount": 2,
|
||||||
|
"authorCount": 2
|
||||||
|
}
|
||||||
|
},
|
||||||
{
|
{
|
||||||
"id": "isDivisible",
|
"id": "isDivisible",
|
||||||
"title": "isDivisible",
|
"title": "isDivisible",
|
||||||
@ -4730,10 +4780,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "682a6b7cfeb58efe9ed7b6daf467c45397df0acecfc21cab59e5ffedd03503ba",
|
"hash": "3db3faac666ee61ab86c70766d2ab5d1293ffd818da87edb971bfff7a366364a",
|
||||||
"firstSeen": "1514801920",
|
"firstSeen": "1514801920",
|
||||||
"lastUpdated": "1577791301",
|
"lastUpdated": "1578058637",
|
||||||
"updateCount": 57,
|
"updateCount": 58,
|
||||||
"authorCount": 7
|
"authorCount": 7
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -5411,9 +5461,9 @@
|
|||||||
"meta": {
|
"meta": {
|
||||||
"hash": "0c04c74cdbb51195f740a163776cb5c4e21a57a59099a1740211cf0764c6c9cc",
|
"hash": "0c04c74cdbb51195f740a163776cb5c4e21a57a59099a1740211cf0764c6c9cc",
|
||||||
"firstSeen": "1578058366",
|
"firstSeen": "1578058366",
|
||||||
"lastUpdated": "1578058366",
|
"lastUpdated": "1578058637",
|
||||||
"updateCount": 2,
|
"updateCount": 3,
|
||||||
"authorCount": 2
|
"authorCount": 3
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -5666,10 +5716,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "b031c3387ef66411ab5d295788eac4247ada5b4b068dda90603d3c973890bc26",
|
"hash": "e8f820ce6da97eabde082ffb829c9fb700e85efc79bdebe883c67237269e3f52",
|
||||||
"firstSeen": "1570824965",
|
"firstSeen": "1570824965",
|
||||||
"lastUpdated": "1577791301",
|
"lastUpdated": "1578058637",
|
||||||
"updateCount": 24,
|
"updateCount": 25,
|
||||||
"authorCount": 4
|
"authorCount": 4
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -6235,10 +6285,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "17bcf3f13980b7f804d9f0fe274324b2a35ab7d479c03d77322dabba81e1a34a",
|
"hash": "7ccbf66d8d55c60bcf12baa980cf32d67a4ba567894d59e2d798c9af792424ff",
|
||||||
"firstSeen": "1517069864",
|
"firstSeen": "1517069864",
|
||||||
"lastUpdated": "1577791301",
|
"lastUpdated": "1578058637",
|
||||||
"updateCount": 81,
|
"updateCount": 82,
|
||||||
"authorCount": 5
|
"authorCount": 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -6882,10 +6932,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "069472d018c3102412dafc2ae8ec6e9396e53c01d0073079f2e3f1ac3c99b6e9",
|
"hash": "c1542907e6295eb81df918174c247a65d73c8daccc56769f2eb32d609b7846fc",
|
||||||
"firstSeen": "1513521691",
|
"firstSeen": "1513521691",
|
||||||
"lastUpdated": "1577791301",
|
"lastUpdated": "1578058637",
|
||||||
"updateCount": 78,
|
"updateCount": 79,
|
||||||
"authorCount": 6
|
"authorCount": 6
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -7398,10 +7448,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "24b93b68a59b49f245590930fed6fb82e286ce09f90e292466cde63c1784c347",
|
"hash": "6dd4c6a51d2c80fa4768c95ae01c16a8359c4140bcad28c7fde0cecd72d7d3e2",
|
||||||
"firstSeen": "1514645161",
|
"firstSeen": "1514645161",
|
||||||
"lastUpdated": "1577791301",
|
"lastUpdated": "1578058637",
|
||||||
"updateCount": 23,
|
"updateCount": 24,
|
||||||
"authorCount": 5
|
"authorCount": 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -12,10 +12,9 @@ Return `false` if the counts do not match for any element, `true` otherwise.
|
|||||||
```js
|
```js
|
||||||
const haveSameContents = (a, b) => {
|
const haveSameContents = (a, b) => {
|
||||||
for (const v of new Set([...a, ...b]))
|
for (const v of new Set([...a, ...b]))
|
||||||
if (a.filter(e => e === v).length !== b.filter(e => e === v).length)
|
if (a.filter(e => e === v).length !== b.filter(e => e === v).length) return false;
|
||||||
return false;
|
|
||||||
return true;
|
return true;
|
||||||
}
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -10,15 +10,17 @@ Use `Array.prototype.some()` to check if all distinct values are contained in th
|
|||||||
Return `false` if the count of any element is greater in the first array than the second one, `true` otherwise.
|
Return `false` if the count of any element is greater in the first array than the second one, `true` otherwise.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
||||||
const isContainedIn = (a, b) => {
|
const isContainedIn = (a, b) => {
|
||||||
for (const v of new Set(a))
|
for (const v of new Set(a)) {
|
||||||
if (
|
if (
|
||||||
!b.some(e => e === v) ||
|
!b.some(e => e === v) ||
|
||||||
a.filter(e => e === v).length > b.filter(e => e === v).length
|
a.filter(e => e === v).length > b.filter(e => e === v).length
|
||||||
)
|
)
|
||||||
return false;
|
return false;
|
||||||
return true;
|
|
||||||
}
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
@ -10,7 +10,6 @@ Determine the `symbol` to be either `?` or `&` based on the `length` of `querySt
|
|||||||
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) => {
|
||||||
|
|||||||
@ -14,7 +14,6 @@ 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)),
|
||||||
|
|||||||
@ -9,6 +9,7 @@ Use `Array.prototype.filter()` to find array elements that return truthy values
|
|||||||
The `func` is invoked with three arguments (`value, index, array`).
|
The `func` is invoked with three arguments (`value, index, array`).
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
||||||
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) => {
|
||||||
|
|||||||
@ -12,7 +12,6 @@ Use `size` of a [`Blob` object](https://developer.mozilla.org/en-US/docs/Web/API
|
|||||||
Split strings into array of characters with `split('')` and return its length.
|
Split strings into array of characters with `split('')` and return its length.
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|
||||||
const size = val =>
|
const size = val =>
|
||||||
Array.isArray(val)
|
Array.isArray(val)
|
||||||
? val.length
|
? val.length
|
||||||
|
|||||||
17
test/_30s.js
17
test/_30s.js
@ -481,6 +481,11 @@ const hasKey = (obj, keys) => {
|
|||||||
})
|
})
|
||||||
);
|
);
|
||||||
};
|
};
|
||||||
|
const haveSameContents = (a, b) => {
|
||||||
|
for (const v of new Set([...a, ...b]))
|
||||||
|
if (a.filter(e => e === v).length !== b.filter(e => e === v).length) return false;
|
||||||
|
return true;
|
||||||
|
};
|
||||||
const head = arr => (arr && arr.length ? arr[0] : undefined);
|
const head = arr => (arr && arr.length ? arr[0] : undefined);
|
||||||
const hexToRGB = hex => {
|
const hexToRGB = hex => {
|
||||||
let alpha = false,
|
let alpha = false,
|
||||||
@ -583,6 +588,16 @@ const isBeforeDate = (dateA, dateB) => dateA < dateB;
|
|||||||
const isBoolean = val => typeof val === 'boolean';
|
const isBoolean = val => typeof val === 'boolean';
|
||||||
const isBrowser = () => ![typeof window, typeof document].includes('undefined');
|
const isBrowser = () => ![typeof window, typeof document].includes('undefined');
|
||||||
const isBrowserTabFocused = () => !document.hidden;
|
const isBrowserTabFocused = () => !document.hidden;
|
||||||
|
const isContainedIn = (a, b) => {
|
||||||
|
for (const v of new Set(a)) {
|
||||||
|
if (
|
||||||
|
!b.some(e => e === v) ||
|
||||||
|
a.filter(e => e === v).length > b.filter(e => e === v).length
|
||||||
|
)
|
||||||
|
return false;
|
||||||
|
}
|
||||||
|
return true;
|
||||||
|
};
|
||||||
const isDivisible = (dividend, divisor) => dividend % divisor === 0;
|
const isDivisible = (dividend, divisor) => dividend % divisor === 0;
|
||||||
const isDuplexStream = val =>
|
const isDuplexStream = val =>
|
||||||
val !== null &&
|
val !== null &&
|
||||||
@ -1587,4 +1602,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,frequencies,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,includesAll,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,isPowerOfTwo,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,mostFrequent,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,weightedSample,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,frequencies,fromCamelCase,functionName,functions,gcd,geometricProgression,get,getColonTimeFromDate,getDaysDiffBetweenDates,getImages,getMeridiemSuffixOfInteger,getScrollPosition,getStyle,getType,getURLParameters,groupBy,hammingDistance,hasClass,hasFlags,hashBrowser,hashNode,hasKey,haveSameContents,head,hexToRGB,hide,httpGet,httpPost,httpsRedirect,hz,includesAll,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,isContainedIn,isDivisible,isDuplexStream,isEmpty,isEven,isFunction,isLowerCase,isNegativeZero,isNil,isNull,isNumber,isObject,isObjectLike,isOdd,isPlainObject,isPowerOfTwo,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,mostFrequent,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,weightedSample,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}
|
||||||
@ -1193,6 +1193,17 @@
|
|||||||
],
|
],
|
||||||
"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.\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.\nReturn `false` beforehand if given key list is empty.\n"
|
||||||
},
|
},
|
||||||
|
"haveSameContents": {
|
||||||
|
"prefix": "30s_haveSameContents",
|
||||||
|
"body": [
|
||||||
|
"const haveSameContents = (a, b) => {",
|
||||||
|
" for (const v of new Set([...a, ...b]))",
|
||||||
|
" if (a.filter(e => e === v).length !== b.filter(e => e === v).length) return false;",
|
||||||
|
" return true;",
|
||||||
|
"};"
|
||||||
|
],
|
||||||
|
"description": "Returns `true` if two arrays contain the same elements regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the values of both arrays.\nUse `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.\nReturn `false` if the counts do not match for any element, `true` otherwise.\n"
|
||||||
|
},
|
||||||
"head": {
|
"head": {
|
||||||
"prefix": "30s_head",
|
"prefix": "30s_head",
|
||||||
"body": [
|
"body": [
|
||||||
@ -1493,6 +1504,22 @@
|
|||||||
],
|
],
|
||||||
"description": "Returns `true` if the browser tab of the page is focused, `false` otherwise.\n\nUse the `Document.hidden` property, introduced by the Page Visibility API to check if the browser tab of the page is visible or hidden.\n"
|
"description": "Returns `true` if the browser tab of the page is focused, `false` otherwise.\n\nUse the `Document.hidden` property, introduced by the Page Visibility API to check if the browser tab of the page is visible or hidden.\n"
|
||||||
},
|
},
|
||||||
|
"isContainedIn": {
|
||||||
|
"prefix": "30s_isContainedIn",
|
||||||
|
"body": [
|
||||||
|
"const isContainedIn = (a, b) => {",
|
||||||
|
" for (const v of new Set(a)) {",
|
||||||
|
" if (",
|
||||||
|
" !b.some(e => e === v) ||",
|
||||||
|
" a.filter(e => e === v).length > b.filter(e => e === v).length",
|
||||||
|
" )",
|
||||||
|
" return false;",
|
||||||
|
" }",
|
||||||
|
" return true;",
|
||||||
|
"};"
|
||||||
|
],
|
||||||
|
"description": "Returns `true` if the elements of the first array are contained in the second one regardless of order, `false` otherwise.\n\nUse a `for...of` loop over a `Set` created from the first array.\nUse `Array.prototype.some()` to check if all distinct values are contained in the second array, use `Array.prototype.filter()` to compare the amount of occurences of each distinct value in both arrays.\nReturn `false` if the count of any element is greater in the first array than the second one, `true` otherwise.\n"
|
||||||
|
},
|
||||||
"isDivisible": {
|
"isDivisible": {
|
||||||
"prefix": "30s_isDivisible",
|
"prefix": "30s_isDivisible",
|
||||||
"body": [
|
"body": [
|
||||||
|
|||||||
Reference in New Issue
Block a user