Travis build: 1795
This commit is contained in:
@ -464,14 +464,14 @@
|
|||||||
"type": "snippetListing",
|
"type": "snippetListing",
|
||||||
"title": "coalesce",
|
"title": "coalesce",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"text": "Returns the first non-null/undefined argument.\n\nUse `Array.prototype.find()` to return the first non `null`/`undefined` argument.\n\n",
|
"text": "Returns the first defined, non-null argument.\n\nUse `Array.prototype.find()` and `Array.prototype.includes()` to find the first value that is not equal to `undefined` or `null`.\n\n",
|
||||||
"tags": [
|
"tags": [
|
||||||
"utility",
|
"utility",
|
||||||
"beginner"
|
"beginner"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "52b7275a934c85ccab144c174f07cf0f3aaf8b1dee913abab020b1be9666d021"
|
"hash": "7c0db11447039e7d9bce2ed420ca1f69671b25928d272596587192a84aa78e31"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -832,7 +832,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "5ab25ab96afd4f1f481fc318b5b290ba8c57a468ef6bca0ca200cfb7fcf3ba9f"
|
"hash": "77a01af8797ecbe71b9c9412d21c144c03a46a49dd3d0e7d869c3df38b39b2b4"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -895,7 +895,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "7a228b650ff668f697e524e0d27ebeff1bfa35e04333b6cd5e742ff63bfea25d"
|
"hash": "6fa14364405f7b99aa49c2157bdc08c02b4ce2f288db29a4348a6983460933c7"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1034,7 +1034,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "5f38360819f9225b887a94221bfee1a80f1bcc224a364440b3388f60491b03ba"
|
"hash": "484bd222e636e8a8409c30ddb1fe6e3fe72ab7a43f2edf089b2758d5e9bee528"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1270,7 +1270,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "55b1ce0a892110d792a9487e40331774015525479faa2b8961f6c2ea6291c27b"
|
"hash": "0eac852db7a7add352b0d36677b22718b342ed9dc12f11780cac87e3b8260a05"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1689,7 +1689,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "16c3b724b653dcb31f3e59f1664a59951abb15a93eb3697cade4d3ae0e63c532"
|
"hash": "9e39c6a3a8ec5b51c5e16f69107fc9e90b2697b2cf2689850872071bb968723e"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1728,14 +1728,14 @@
|
|||||||
"type": "snippetListing",
|
"type": "snippetListing",
|
||||||
"title": "getType",
|
"title": "getType",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"text": "Returns the native type of a value.\n\nReturns lowercased constructor name of value, `\"undefined\"` or `\"null\"` if value is `undefined` or `null`.\n\n",
|
"text": "Returns the native type of a value.\n\nReturn `\"undefined\"` or `\"null\"` if the value is `undefined` or `null`.\nOtherwise, use `Object.prototype.constructor.name` to get the name of the constructor, `String.prototype.toLowerCase()` to return it in lowercase.\n\n",
|
||||||
"tags": [
|
"tags": [
|
||||||
"type",
|
"type",
|
||||||
"beginner"
|
"beginner"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "7209ddadbe2402ac811e20f69feecbb682ee8ec0545dc4d0839455d4cb790432"
|
"hash": "87c0b3cc13caebf6bb46f0769fecc8b13140ea133bbf096136c740154c1d456f"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -1777,14 +1777,15 @@
|
|||||||
"type": "snippetListing",
|
"type": "snippetListing",
|
||||||
"title": "hammingDistance",
|
"title": "hammingDistance",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"text": "Calculates the Hamming distance between two values.\n\nUse XOR operator (`^`) to find the bit difference between the two numbers, convert to a binary string using `toString(2)`.\nCount and return the number of `1`s in the string, using `match(/1/g)`.\n\n",
|
"text": "Calculates the Hamming distance between two values.\n\nUse the XOR operator (`^`) to find the bit difference between the two numbers, convert to a binary string using `toString(2)`.\nCount and return the number of `1`s in the string, using `match(/1/g)`.\n\n",
|
||||||
"tags": [
|
"tags": [
|
||||||
"math",
|
"math",
|
||||||
"beginner"
|
"regexp",
|
||||||
|
"intermediate"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "b4234c37a89fb91b38283fc4ce8c4ccb2d7fb62d522f0becad4dd3d6a62efe56"
|
"hash": "bab775633603d798a5475f4bd22afdcbdea8bfdf81ea58eba661c16ee2a1ffbf"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -2536,14 +2537,14 @@
|
|||||||
"type": "snippetListing",
|
"type": "snippetListing",
|
||||||
"title": "isNil",
|
"title": "isNil",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"text": "Returns `true` if the specified value is `null` or `undefined`, `false` otherwise.\n\nUse the strict equality operator to check if the value and of `val` are equal to `null` or `undefined`.\n\n",
|
"text": "Returns `true` if the specified value is `null` or `undefined`, `false` otherwise.\n\nUse the strict equality operator to check if the value of `val` is equal to `null` or `undefined`.\n\n",
|
||||||
"tags": [
|
"tags": [
|
||||||
"type",
|
"type",
|
||||||
"beginner"
|
"beginner"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "fd508fc1174e19116709b5979af67b3bcc48100b19e5a87e15b9545ba0a56d88"
|
"hash": "c09e927ebf399af3fa3bd3873b407f26130f86e6abb7871f88e1892baed899bf"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -2551,14 +2552,14 @@
|
|||||||
"type": "snippetListing",
|
"type": "snippetListing",
|
||||||
"title": "isNull",
|
"title": "isNull",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"text": "Returns `true` if the specified value is `null`, `false` otherwise.\n\nUse the strict equality operator to check if the value and of `val` are equal to `null`.\n\n",
|
"text": "Returns `true` if the specified value is `null`, `false` otherwise.\n\nUse the strict equality operator to check if the value of `val` is equal to `null`.\n\n",
|
||||||
"tags": [
|
"tags": [
|
||||||
"type",
|
"type",
|
||||||
"beginner"
|
"beginner"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "ecce7adac512977eb9a1f6ea9644c1e1318ca8611512009fbd55ea38519aa1c3"
|
"hash": "4247f69d4cb570cccbe23e147336e5a610070be0fce5d3c5011f7b04a6f9ed3e"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -2820,14 +2821,14 @@
|
|||||||
"type": "snippetListing",
|
"type": "snippetListing",
|
||||||
"title": "isUndefined",
|
"title": "isUndefined",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"text": "Returns `true` if the specified value is `undefined`, `false` otherwise.\n\nUse the strict equality operator to check if the value and of `val` are equal to `undefined`.\n\n",
|
"text": "Returns `true` if the specified value is `undefined`, `false` otherwise.\n\nUse the strict equality operator to check if `val` is equal to `undefined`.\n\n",
|
||||||
"tags": [
|
"tags": [
|
||||||
"type",
|
"type",
|
||||||
"beginner"
|
"beginner"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "6ebaa03264b6b2f637f8380b8796ebdc820a2031db72fcfd5d6d657af79b496c"
|
"hash": "c76d495087390da80a6a0d54f27220254b0cd547a79ac1357a4b04e43938794a"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -2920,7 +2921,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "3db3faac666ee61ab86c70766d2ab5d1293ffd818da87edb971bfff7a366364a"
|
"hash": "362fddaa6244404741e84bca6fc442a101fdb642af53b299e8b9994d0d7162d8"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -3495,7 +3496,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "e8f820ce6da97eabde082ffb829c9fb700e85efc79bdebe883c67237269e3f52"
|
"hash": "b031c3387ef66411ab5d295788eac4247ada5b4b068dda90603d3c973890bc26"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -3841,7 +3842,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "a2b9ac4f1209c3791caa6f40f0d041acd75514e9ee8909f2e3833635f357c0bd"
|
"hash": "0eb844801e767edcaa6a882a6dce4b5b1dadecb53a92d6ec259d36c57b6a3dd0"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -4235,7 +4236,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "c1542907e6295eb81df918174c247a65d73c8daccc56769f2eb32d609b7846fc"
|
"hash": "069472d018c3102412dafc2ae8ec6e9396e53c01d0073079f2e3f1ac3c99b6e9"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -4551,7 +4552,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "6dd4c6a51d2c80fa4768c95ae01c16a8359c4140bcad28c7fde0cecd72d7d3e2"
|
"hash": "24b93b68a59b49f245590930fed6fb82e286ce09f90e292466cde63c1784c347"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
@ -5117,7 +5118,7 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "ebe1997777f4fb4c97cd5ae23a0cc590a0aab8f6762ae1d39c17f27bf2efe1c6"
|
"hash": "b893c5ab5d118c46dc7b673413adbeddd967093c36225eb31cf446c95de0ff39"
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
{
|
{
|
||||||
|
|||||||
@ -755,11 +755,11 @@
|
|||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"fileName": "coalesce.md",
|
"fileName": "coalesce.md",
|
||||||
"text": "Returns the first non-null/undefined argument.\n\nUse `Array.prototype.find()` to return the first non `null`/`undefined` argument.\n\n",
|
"text": "Returns the first defined, non-null argument.\n\nUse `Array.prototype.find()` and `Array.prototype.includes()` to find the first value that is not equal to `undefined` or `null`.\n\n",
|
||||||
"codeBlocks": {
|
"codeBlocks": {
|
||||||
"es6": "const coalesce = (...args) => args.find(_ => ![undefined, null].includes(_));",
|
"es6": "const coalesce = (...args) => args.find(v => ![undefined, null].includes(v));",
|
||||||
"es5": "var coalesce = function coalesce() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return args.find(function (_) {\n return ![undefined, null].includes(_);\n });\n};",
|
"es5": "var coalesce = function coalesce() {\n for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {\n args[_key] = arguments[_key];\n }\n\n return args.find(function (v) {\n return ![undefined, null].includes(v);\n });\n};",
|
||||||
"example": "coalesce(null, undefined, '', NaN, 'Waldo'); // \"\""
|
"example": "coalesce(null, undefined, '', NaN, 'Waldo'); // ''"
|
||||||
},
|
},
|
||||||
"tags": [
|
"tags": [
|
||||||
"utility",
|
"utility",
|
||||||
@ -767,10 +767,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "52b7275a934c85ccab144c174f07cf0f3aaf8b1dee913abab020b1be9666d021",
|
"hash": "7c0db11447039e7d9bce2ed420ca1f69671b25928d272596587192a84aa78e31",
|
||||||
"firstSeen": "1513498135",
|
"firstSeen": "1513498135",
|
||||||
"lastUpdated": "1565681352",
|
"lastUpdated": "1583442418",
|
||||||
"updateCount": 10,
|
"updateCount": 11,
|
||||||
"authorCount": 6
|
"authorCount": 6
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1358,10 +1358,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "5ab25ab96afd4f1f481fc318b5b290ba8c57a468ef6bca0ca200cfb7fcf3ba9f",
|
"hash": "77a01af8797ecbe71b9c9412d21c144c03a46a49dd3d0e7d869c3df38b39b2b4",
|
||||||
"firstSeen": "1516733326",
|
"firstSeen": "1516733326",
|
||||||
"lastUpdated": "1582054301",
|
"lastUpdated": "1582057110",
|
||||||
"updateCount": 64,
|
"updateCount": 65,
|
||||||
"authorCount": 9
|
"authorCount": 9
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1461,10 +1461,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "7a228b650ff668f697e524e0d27ebeff1bfa35e04333b6cd5e742ff63bfea25d",
|
"hash": "6fa14364405f7b99aa49c2157bdc08c02b4ce2f288db29a4348a6983460933c7",
|
||||||
"firstSeen": "1544374334\n1543497773",
|
"firstSeen": "1544374334\n1543497773",
|
||||||
"lastUpdated": "1582054301",
|
"lastUpdated": "1582057110",
|
||||||
"updateCount": 76,
|
"updateCount": 77,
|
||||||
"authorCount": 4
|
"authorCount": 4
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -1690,10 +1690,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "5f38360819f9225b887a94221bfee1a80f1bcc224a364440b3388f60491b03ba",
|
"hash": "484bd222e636e8a8409c30ddb1fe6e3fe72ab7a43f2edf089b2758d5e9bee528",
|
||||||
"firstSeen": "1531080384",
|
"firstSeen": "1531080384",
|
||||||
"lastUpdated": "1582054301",
|
"lastUpdated": "1582057110",
|
||||||
"updateCount": 101,
|
"updateCount": 102,
|
||||||
"authorCount": 5
|
"authorCount": 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2076,10 +2076,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "55b1ce0a892110d792a9487e40331774015525479faa2b8961f6c2ea6291c27b",
|
"hash": "0eac852db7a7add352b0d36677b22718b342ed9dc12f11780cac87e3b8260a05",
|
||||||
"firstSeen": "1512650493",
|
"firstSeen": "1512650493",
|
||||||
"lastUpdated": "1582054301",
|
"lastUpdated": "1582057110",
|
||||||
"updateCount": 106,
|
"updateCount": 107,
|
||||||
"authorCount": 6
|
"authorCount": 6
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2765,10 +2765,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "16c3b724b653dcb31f3e59f1664a59951abb15a93eb3697cade4d3ae0e63c532",
|
"hash": "9e39c6a3a8ec5b51c5e16f69107fc9e90b2697b2cf2689850872071bb968723e",
|
||||||
"firstSeen": "1515856488",
|
"firstSeen": "1515856488",
|
||||||
"lastUpdated": "1582054301",
|
"lastUpdated": "1582057110",
|
||||||
"updateCount": 65,
|
"updateCount": 66,
|
||||||
"authorCount": 4
|
"authorCount": 4
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2829,7 +2829,7 @@
|
|||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"fileName": "getType.md",
|
"fileName": "getType.md",
|
||||||
"text": "Returns the native type of a value.\n\nReturns lowercased constructor name of value, `\"undefined\"` or `\"null\"` if value is `undefined` or `null`.\n\n",
|
"text": "Returns the native type of a value.\n\nReturn `\"undefined\"` or `\"null\"` if the value is `undefined` or `null`.\nOtherwise, use `Object.prototype.constructor.name` to get the name of the constructor, `String.prototype.toLowerCase()` to return it in lowercase.\n\n",
|
||||||
"codeBlocks": {
|
"codeBlocks": {
|
||||||
"es6": "const getType = v =>\n v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase();",
|
"es6": "const getType = v =>\n v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase();",
|
||||||
"es5": "var getType = function getType(v) {\n return v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase();\n};",
|
"es5": "var getType = function getType(v) {\n return v === undefined ? 'undefined' : v === null ? 'null' : v.constructor.name.toLowerCase();\n};",
|
||||||
@ -2841,10 +2841,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "7209ddadbe2402ac811e20f69feecbb682ee8ec0545dc4d0839455d4cb790432",
|
"hash": "87c0b3cc13caebf6bb46f0769fecc8b13140ea133bbf096136c740154c1d456f",
|
||||||
"firstSeen": "1513526151",
|
"firstSeen": "1513526151",
|
||||||
"lastUpdated": "1565681352",
|
"lastUpdated": "1583442386",
|
||||||
"updateCount": 10,
|
"updateCount": 11,
|
||||||
"authorCount": 6
|
"authorCount": 6
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -2908,7 +2908,7 @@
|
|||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"fileName": "hammingDistance.md",
|
"fileName": "hammingDistance.md",
|
||||||
"text": "Calculates the Hamming distance between two values.\n\nUse XOR operator (`^`) to find the bit difference between the two numbers, convert to a binary string using `toString(2)`.\nCount and return the number of `1`s in the string, using `match(/1/g)`.\n\n",
|
"text": "Calculates the Hamming distance between two values.\n\nUse the XOR operator (`^`) to find the bit difference between the two numbers, convert to a binary string using `toString(2)`.\nCount and return the number of `1`s in the string, using `match(/1/g)`.\n\n",
|
||||||
"codeBlocks": {
|
"codeBlocks": {
|
||||||
"es6": "const hammingDistance = (num1, num2) => ((num1 ^ num2).toString(2).match(/1/g) || '').length;",
|
"es6": "const hammingDistance = (num1, num2) => ((num1 ^ num2).toString(2).match(/1/g) || '').length;",
|
||||||
"es5": "var hammingDistance = function hammingDistance(num1, num2) {\n return ((num1 ^ num2).toString(2).match(/1/g) || '').length;\n};",
|
"es5": "var hammingDistance = function hammingDistance(num1, num2) {\n return ((num1 ^ num2).toString(2).match(/1/g) || '').length;\n};",
|
||||||
@ -2916,14 +2916,15 @@
|
|||||||
},
|
},
|
||||||
"tags": [
|
"tags": [
|
||||||
"math",
|
"math",
|
||||||
"beginner"
|
"regexp",
|
||||||
|
"intermediate"
|
||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "b4234c37a89fb91b38283fc4ce8c4ccb2d7fb62d522f0becad4dd3d6a62efe56",
|
"hash": "bab775633603d798a5475f4bd22afdcbdea8bfdf81ea58eba661c16ee2a1ffbf",
|
||||||
"firstSeen": "1513526151",
|
"firstSeen": "1513526151",
|
||||||
"lastUpdated": "1565681352",
|
"lastUpdated": "1583442408",
|
||||||
"updateCount": 7,
|
"updateCount": 8,
|
||||||
"authorCount": 5
|
"authorCount": 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -4147,7 +4148,7 @@
|
|||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"fileName": "isNil.md",
|
"fileName": "isNil.md",
|
||||||
"text": "Returns `true` if the specified value is `null` or `undefined`, `false` otherwise.\n\nUse the strict equality operator to check if the value and of `val` are equal to `null` or `undefined`.\n\n",
|
"text": "Returns `true` if the specified value is `null` or `undefined`, `false` otherwise.\n\nUse the strict equality operator to check if the value of `val` is equal to `null` or `undefined`.\n\n",
|
||||||
"codeBlocks": {
|
"codeBlocks": {
|
||||||
"es6": "const isNil = val => val === undefined || val === null;",
|
"es6": "const isNil = val => val === undefined || val === null;",
|
||||||
"es5": "var isNil = function isNil(val) {\n return val === undefined || val === null;\n};",
|
"es5": "var isNil = function isNil(val) {\n return val === undefined || val === null;\n};",
|
||||||
@ -4159,10 +4160,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "fd508fc1174e19116709b5979af67b3bcc48100b19e5a87e15b9545ba0a56d88",
|
"hash": "c09e927ebf399af3fa3bd3873b407f26130f86e6abb7871f88e1892baed899bf",
|
||||||
"firstSeen": "1516114221",
|
"firstSeen": "1516114221",
|
||||||
"lastUpdated": "1565681352",
|
"lastUpdated": "1583442386",
|
||||||
"updateCount": 3,
|
"updateCount": 4,
|
||||||
"authorCount": 2
|
"authorCount": 2
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -4172,7 +4173,7 @@
|
|||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"fileName": "isNull.md",
|
"fileName": "isNull.md",
|
||||||
"text": "Returns `true` if the specified value is `null`, `false` otherwise.\n\nUse the strict equality operator to check if the value and of `val` are equal to `null`.\n\n",
|
"text": "Returns `true` if the specified value is `null`, `false` otherwise.\n\nUse the strict equality operator to check if the value of `val` is equal to `null`.\n\n",
|
||||||
"codeBlocks": {
|
"codeBlocks": {
|
||||||
"es6": "const isNull = val => val === null;",
|
"es6": "const isNull = val => val === null;",
|
||||||
"es5": "var isNull = function isNull(val) {\n return val === null;\n};",
|
"es5": "var isNull = function isNull(val) {\n return val === null;\n};",
|
||||||
@ -4184,10 +4185,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "ecce7adac512977eb9a1f6ea9644c1e1318ca8611512009fbd55ea38519aa1c3",
|
"hash": "4247f69d4cb570cccbe23e147336e5a610070be0fce5d3c5011f7b04a6f9ed3e",
|
||||||
"firstSeen": "1514715979",
|
"firstSeen": "1514715979",
|
||||||
"lastUpdated": "1565681352",
|
"lastUpdated": "1583442386",
|
||||||
"updateCount": 5,
|
"updateCount": 6,
|
||||||
"authorCount": 3
|
"authorCount": 3
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -4611,7 +4612,7 @@
|
|||||||
"type": "snippet",
|
"type": "snippet",
|
||||||
"attributes": {
|
"attributes": {
|
||||||
"fileName": "isUndefined.md",
|
"fileName": "isUndefined.md",
|
||||||
"text": "Returns `true` if the specified value is `undefined`, `false` otherwise.\n\nUse the strict equality operator to check if the value and of `val` are equal to `undefined`.\n\n",
|
"text": "Returns `true` if the specified value is `undefined`, `false` otherwise.\n\nUse the strict equality operator to check if `val` is equal to `undefined`.\n\n",
|
||||||
"codeBlocks": {
|
"codeBlocks": {
|
||||||
"es6": "const isUndefined = val => val === undefined;",
|
"es6": "const isUndefined = val => val === undefined;",
|
||||||
"es5": "var isUndefined = function isUndefined(val) {\n return val === undefined;\n};",
|
"es5": "var isUndefined = function isUndefined(val) {\n return val === undefined;\n};",
|
||||||
@ -4623,10 +4624,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "6ebaa03264b6b2f637f8380b8796ebdc820a2031db72fcfd5d6d657af79b496c",
|
"hash": "c76d495087390da80a6a0d54f27220254b0cd547a79ac1357a4b04e43938794a",
|
||||||
"firstSeen": "1516114221",
|
"firstSeen": "1516114221",
|
||||||
"lastUpdated": "1565681352",
|
"lastUpdated": "1583442386",
|
||||||
"updateCount": 3,
|
"updateCount": 4,
|
||||||
"authorCount": 2
|
"authorCount": 2
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -4776,10 +4777,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "3db3faac666ee61ab86c70766d2ab5d1293ffd818da87edb971bfff7a366364a",
|
"hash": "362fddaa6244404741e84bca6fc442a101fdb642af53b299e8b9994d0d7162d8",
|
||||||
"firstSeen": "1514801920",
|
"firstSeen": "1514801920",
|
||||||
"lastUpdated": "1582054301",
|
"lastUpdated": "1582057110",
|
||||||
"updateCount": 72,
|
"updateCount": 73,
|
||||||
"authorCount": 7
|
"authorCount": 7
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -5711,10 +5712,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "e8f820ce6da97eabde082ffb829c9fb700e85efc79bdebe883c67237269e3f52",
|
"hash": "b031c3387ef66411ab5d295788eac4247ada5b4b068dda90603d3c973890bc26",
|
||||||
"firstSeen": "1570824965",
|
"firstSeen": "1570824965",
|
||||||
"lastUpdated": "1582054301",
|
"lastUpdated": "1582057110",
|
||||||
"updateCount": 39,
|
"updateCount": 40,
|
||||||
"authorCount": 4
|
"authorCount": 4
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -6277,10 +6278,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "a2b9ac4f1209c3791caa6f40f0d041acd75514e9ee8909f2e3833635f357c0bd",
|
"hash": "0eb844801e767edcaa6a882a6dce4b5b1dadecb53a92d6ec259d36c57b6a3dd0",
|
||||||
"firstSeen": "1517069864",
|
"firstSeen": "1517069864",
|
||||||
"lastUpdated": "1582054301",
|
"lastUpdated": "1582057110",
|
||||||
"updateCount": 97,
|
"updateCount": 98,
|
||||||
"authorCount": 5
|
"authorCount": 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -6921,10 +6922,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "c1542907e6295eb81df918174c247a65d73c8daccc56769f2eb32d609b7846fc",
|
"hash": "069472d018c3102412dafc2ae8ec6e9396e53c01d0073079f2e3f1ac3c99b6e9",
|
||||||
"firstSeen": "1513521691",
|
"firstSeen": "1513521691",
|
||||||
"lastUpdated": "1582054301",
|
"lastUpdated": "1582057110",
|
||||||
"updateCount": 93,
|
"updateCount": 94,
|
||||||
"authorCount": 6
|
"authorCount": 6
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -7437,10 +7438,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "6dd4c6a51d2c80fa4768c95ae01c16a8359c4140bcad28c7fde0cecd72d7d3e2",
|
"hash": "24b93b68a59b49f245590930fed6fb82e286ce09f90e292466cde63c1784c347",
|
||||||
"firstSeen": "1514645161",
|
"firstSeen": "1514645161",
|
||||||
"lastUpdated": "1582054301",
|
"lastUpdated": "1582057110",
|
||||||
"updateCount": 38,
|
"updateCount": 39,
|
||||||
"authorCount": 5
|
"authorCount": 5
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
@ -8363,10 +8364,10 @@
|
|||||||
]
|
]
|
||||||
},
|
},
|
||||||
"meta": {
|
"meta": {
|
||||||
"hash": "ebe1997777f4fb4c97cd5ae23a0cc590a0aab8f6762ae1d39c17f27bf2efe1c6",
|
"hash": "b893c5ab5d118c46dc7b673413adbeddd967093c36225eb31cf446c95de0ff39",
|
||||||
"firstSeen": "1515424366",
|
"firstSeen": "1515424366",
|
||||||
"lastUpdated": "1565681352",
|
"lastUpdated": "1583442408",
|
||||||
"updateCount": 3,
|
"updateCount": 4,
|
||||||
"authorCount": 2
|
"authorCount": 2
|
||||||
}
|
}
|
||||||
},
|
},
|
||||||
|
|||||||
@ -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);
|
||||||
|
|||||||
@ -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))
|
||||||
|
|||||||
@ -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]
|
||||||
|
|||||||
@ -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
|
||||||
? (() => {
|
? (() => {
|
||||||
|
|||||||
@ -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'
|
||||||
|
|||||||
@ -11,6 +11,7 @@ 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) =>
|
||||||
|
|||||||
@ -10,6 +10,7 @@ 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,6 +14,7 @@ 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,7 +9,6 @@ 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,6 +12,7 @@ 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
|
||||||
|
|||||||
@ -10,9 +10,7 @@ Use `Math.round()` to convert to an integer.
|
|||||||
|
|
||||||
```js
|
```js
|
||||||
const toSafeInteger = num =>
|
const toSafeInteger = num =>
|
||||||
Math.round(
|
Math.round(Math.max(Math.min(num, Number.MAX_SAFE_INTEGER), Number.MIN_SAFE_INTEGER));
|
||||||
Math.max(Math.min(num, Number.MAX_SAFE_INTEGER), Number.MIN_SAFE_INTEGER)
|
|
||||||
);
|
|
||||||
```
|
```
|
||||||
|
|
||||||
```js
|
```js
|
||||||
|
|||||||
Reference in New Issue
Block a user