Travis build: 1797
This commit is contained in:
@ -746,7 +746,7 @@
|
||||
"type": "snippetListing",
|
||||
"title": "currentURL",
|
||||
"attributes": {
|
||||
"text": "Returns the current URL.\n\nUse `window.location.href` to get current URL.\n\n",
|
||||
"text": "Returns the current URL.\n\nUse `window.location.href` to get the current URL.\n\n",
|
||||
"tags": [
|
||||
"browser",
|
||||
"url",
|
||||
@ -754,7 +754,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "f51d4d8679fadabe84e72547013537a5fcb7bcedd7907f79934fba06405097c7"
|
||||
"hash": "a28cd0828b50d589cda564a36076a297c0181598d7400aefe5184412682485e3"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -832,7 +832,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "77a01af8797ecbe71b9c9412d21c144c03a46a49dd3d0e7d869c3df38b39b2b4"
|
||||
"hash": "0a4684d6fc79bdbbac31df3af6c493ba7c881936ada5bc52824b4f26ca177459"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -895,7 +895,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "6fa14364405f7b99aa49c2157bdc08c02b4ce2f288db29a4348a6983460933c7"
|
||||
"hash": "a4e1e33c0688dbf1ca231d9d8ea315ffed93b7f83f5d8cbf0714f10fdfeda8cf"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -1034,7 +1034,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "484bd222e636e8a8409c30ddb1fe6e3fe72ab7a43f2edf089b2758d5e9bee528"
|
||||
"hash": "5f38360819f9225b887a94221bfee1a80f1bcc224a364440b3388f60491b03ba"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -1270,7 +1270,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "0eac852db7a7add352b0d36677b22718b342ed9dc12f11780cac87e3b8260a05"
|
||||
"hash": "55b1ce0a892110d792a9487e40331774015525479faa2b8961f6c2ea6291c27b"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -1689,7 +1689,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "9e39c6a3a8ec5b51c5e16f69107fc9e90b2697b2cf2689850872071bb968723e"
|
||||
"hash": "16c3b724b653dcb31f3e59f1664a59951abb15a93eb3697cade4d3ae0e63c532"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -2178,7 +2178,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "9a2e1d5c50b955f8be4e0ee6b63894525be4904905a62c483789dd4e3d4bb11e"
|
||||
"hash": "ed0aaf8c5ebaa3b1e75a60af42c56ad19d3b99c6ba7257e1cfd4b245546b528f"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -2193,7 +2193,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "72db2aadee9327a4e794727fd39a254cc9cfcaa4f0819b2d03ad3c39c950264b"
|
||||
"hash": "bf4e5f5e31ce7057a18c2b54dd516ec647819b5a5246a93e883ade756ff39fd9"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -2921,7 +2921,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "362fddaa6244404741e84bca6fc442a101fdb642af53b299e8b9994d0d7162d8"
|
||||
"hash": "3db3faac666ee61ab86c70766d2ab5d1293ffd818da87edb971bfff7a366364a"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -3496,7 +3496,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "b031c3387ef66411ab5d295788eac4247ada5b4b068dda90603d3c973890bc26"
|
||||
"hash": "e8f820ce6da97eabde082ffb829c9fb700e85efc79bdebe883c67237269e3f52"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -3677,14 +3677,14 @@
|
||||
"type": "snippetListing",
|
||||
"title": "pad",
|
||||
"attributes": {
|
||||
"text": "Pads a string on both sides with the specified character, if it's shorter than the specified length.\n\nUse `String.padStart()` and `String.padEnd()` to pad both sides of the given string.\nOmit the third argument, `char`, to use the whitespace character as the default padding character.\n\n",
|
||||
"text": "Pads a string on both sides with the specified character, if it's shorter than the specified length.\n\nUse `String.prototype.padStart()` and `String.prototype.padEnd()` to pad both sides of the given string.\nOmit the third argument, `char`, to use the whitespace character as the default padding character.\n\n",
|
||||
"tags": [
|
||||
"string",
|
||||
"beginner"
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "04a1e9e83ff8bb138a86e7bb060a19de2593bc4054ce48cfef511eec1052edbe"
|
||||
"hash": "d330cea0a63c1e50ca7f0203024ab7a7994e15cdaa04361e8a99feaf71ffb42f"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -3842,7 +3842,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "0eb844801e767edcaa6a882a6dce4b5b1dadecb53a92d6ec259d36c57b6a3dd0"
|
||||
"hash": "a2b9ac4f1209c3791caa6f40f0d041acd75514e9ee8909f2e3833635f357c0bd"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -4236,7 +4236,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "069472d018c3102412dafc2ae8ec6e9396e53c01d0073079f2e3f1ac3c99b6e9"
|
||||
"hash": "c1542907e6295eb81df918174c247a65d73c8daccc56769f2eb32d609b7846fc"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -4450,14 +4450,14 @@
|
||||
"type": "snippetListing",
|
||||
"title": "setStyle",
|
||||
"attributes": {
|
||||
"text": "Sets the value of a CSS rule for the specified element.\n\nUse `element.style` to set the value of the CSS rule for the specified element to `val`.\n\n",
|
||||
"text": "Sets the value of a CSS rule for the specified HTML element.\n\nUse `element.style` to set the value of the CSS rule for the specified element to `val`.\n\n",
|
||||
"tags": [
|
||||
"browser",
|
||||
"beginner"
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "8f531d87240d659970223c06c464bb1434fb3096e365d48dccb5c386a39e1ac4"
|
||||
"hash": "3af57aa88e446dcfa4f1a7a8a434b541445e91cb366f0c56184c5e09f7c961cb"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -4552,7 +4552,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "24b93b68a59b49f245590930fed6fb82e286ce09f90e292466cde63c1784c347"
|
||||
"hash": "6dd4c6a51d2c80fa4768c95ae01c16a8359c4140bcad28c7fde0cecd72d7d3e2"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -5018,7 +5018,7 @@
|
||||
"type": "snippetListing",
|
||||
"title": "toDecimalMark",
|
||||
"attributes": {
|
||||
"text": "Use `toLocaleString()` to convert a float-point arithmetic to the [Decimal mark](https://en.wikipedia.org/wiki/Decimal_mark) form. It makes a comma separated string from a number.\n\n",
|
||||
"text": "Converts a number to a decimal mark formatted string.\n\nUse `Number.prototype.toLocaleString()` to convert the numbre to decimal mark format.\n\n",
|
||||
"tags": [
|
||||
"utility",
|
||||
"math",
|
||||
@ -5026,7 +5026,7 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "426eb2319298548df80de3db701eb3c130abd4ff9613a87bd2ae55f76aae7039"
|
||||
"hash": "22c2a4835f37334d3b5fa5f83bbaaddc642feb71c1868f514928c656e250abe6"
|
||||
}
|
||||
},
|
||||
{
|
||||
@ -5034,14 +5034,14 @@
|
||||
"type": "snippetListing",
|
||||
"title": "toggleClass",
|
||||
"attributes": {
|
||||
"text": "Toggle a class for an element.\n\nUse `element.classList.toggle()` to toggle the specified class for the element.\n\n",
|
||||
"text": "Toggles a class for an HTML element.\n\nUse `element.classList.toggle()` to toggle the specified class for the element.\n\n",
|
||||
"tags": [
|
||||
"browser",
|
||||
"beginner"
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "994b3e4bd75982d26fef1b3812890b90118c8d89aec6e8a666ce7e132c382081"
|
||||
"hash": "34abfb52d68cbd59aa575d0a1620312798264526dfa006f3bf52883e92e41105"
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -1217,7 +1217,7 @@
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "currentURL.md",
|
||||
"text": "Returns the current URL.\n\nUse `window.location.href` to get current URL.\n\n",
|
||||
"text": "Returns the current URL.\n\nUse `window.location.href` to get the current URL.\n\n",
|
||||
"codeBlocks": {
|
||||
"es6": "const currentURL = () => window.location.href;",
|
||||
"es5": "var currentURL = function currentURL() {\n return window.location.href;\n};",
|
||||
@ -1230,10 +1230,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "f51d4d8679fadabe84e72547013537a5fcb7bcedd7907f79934fba06405097c7",
|
||||
"hash": "a28cd0828b50d589cda564a36076a297c0181598d7400aefe5184412682485e3",
|
||||
"firstSeen": "1513587903",
|
||||
"lastUpdated": "1565681352",
|
||||
"updateCount": 7,
|
||||
"lastUpdated": "1583481460",
|
||||
"updateCount": 8,
|
||||
"authorCount": 5
|
||||
}
|
||||
},
|
||||
@ -1358,10 +1358,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "77a01af8797ecbe71b9c9412d21c144c03a46a49dd3d0e7d869c3df38b39b2b4",
|
||||
"hash": "0a4684d6fc79bdbbac31df3af6c493ba7c881936ada5bc52824b4f26ca177459",
|
||||
"firstSeen": "1516733326",
|
||||
"lastUpdated": "1582057110",
|
||||
"updateCount": 65,
|
||||
"lastUpdated": "1583442609",
|
||||
"updateCount": 66,
|
||||
"authorCount": 9
|
||||
}
|
||||
},
|
||||
@ -1461,10 +1461,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "6fa14364405f7b99aa49c2157bdc08c02b4ce2f288db29a4348a6983460933c7",
|
||||
"hash": "a4e1e33c0688dbf1ca231d9d8ea315ffed93b7f83f5d8cbf0714f10fdfeda8cf",
|
||||
"firstSeen": "1544374334\n1543497773",
|
||||
"lastUpdated": "1582057110",
|
||||
"updateCount": 77,
|
||||
"lastUpdated": "1583442609",
|
||||
"updateCount": 78,
|
||||
"authorCount": 4
|
||||
}
|
||||
},
|
||||
@ -1690,10 +1690,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "484bd222e636e8a8409c30ddb1fe6e3fe72ab7a43f2edf089b2758d5e9bee528",
|
||||
"hash": "5f38360819f9225b887a94221bfee1a80f1bcc224a364440b3388f60491b03ba",
|
||||
"firstSeen": "1531080384",
|
||||
"lastUpdated": "1582057110",
|
||||
"updateCount": 102,
|
||||
"lastUpdated": "1583442609",
|
||||
"updateCount": 103,
|
||||
"authorCount": 5
|
||||
}
|
||||
},
|
||||
@ -2076,10 +2076,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "0eac852db7a7add352b0d36677b22718b342ed9dc12f11780cac87e3b8260a05",
|
||||
"hash": "55b1ce0a892110d792a9487e40331774015525479faa2b8961f6c2ea6291c27b",
|
||||
"firstSeen": "1512650493",
|
||||
"lastUpdated": "1582057110",
|
||||
"updateCount": 107,
|
||||
"lastUpdated": "1583442609",
|
||||
"updateCount": 108,
|
||||
"authorCount": 6
|
||||
}
|
||||
},
|
||||
@ -2765,10 +2765,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "9e39c6a3a8ec5b51c5e16f69107fc9e90b2697b2cf2689850872071bb968723e",
|
||||
"hash": "16c3b724b653dcb31f3e59f1664a59951abb15a93eb3697cade4d3ae0e63c532",
|
||||
"firstSeen": "1515856488",
|
||||
"lastUpdated": "1582057110",
|
||||
"updateCount": 66,
|
||||
"lastUpdated": "1583442609",
|
||||
"updateCount": 67,
|
||||
"authorCount": 4
|
||||
}
|
||||
},
|
||||
@ -3556,7 +3556,7 @@
|
||||
"codeBlocks": {
|
||||
"es6": "const insertAfter = (el, htmlString) => el.insertAdjacentHTML('afterend', htmlString);",
|
||||
"es5": "var insertAfter = function insertAfter(el, htmlString) {\n return el.insertAdjacentHTML('afterend', htmlString);\n};",
|
||||
"example": "insertAfter(document.getElementById('myId'), '<p>after</p>'); // <div id=\"myId\">...</div> <p>after</p>"
|
||||
"example": "insertAfter(document.getElementById('myId'), '<p>after</p>');\n// <div id=\"myId\">...</div> <p>after</p>"
|
||||
},
|
||||
"tags": [
|
||||
"browser",
|
||||
@ -3564,10 +3564,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "9a2e1d5c50b955f8be4e0ee6b63894525be4904905a62c483789dd4e3d4bb11e",
|
||||
"hash": "ed0aaf8c5ebaa3b1e75a60af42c56ad19d3b99c6ba7257e1cfd4b245546b528f",
|
||||
"firstSeen": "1529431078",
|
||||
"lastUpdated": "1565681352",
|
||||
"updateCount": 4,
|
||||
"lastUpdated": "1583481460",
|
||||
"updateCount": 5,
|
||||
"authorCount": 3
|
||||
}
|
||||
},
|
||||
@ -3581,7 +3581,7 @@
|
||||
"codeBlocks": {
|
||||
"es6": "const insertBefore = (el, htmlString) => el.insertAdjacentHTML('beforebegin', htmlString);",
|
||||
"es5": "var insertBefore = function insertBefore(el, htmlString) {\n return el.insertAdjacentHTML('beforebegin', htmlString);\n};",
|
||||
"example": "insertBefore(document.getElementById('myId'), '<p>before</p>'); // <p>before</p> <div id=\"myId\">...</div>"
|
||||
"example": "insertBefore(document.getElementById('myId'), '<p>before</p>');\n// <p>before</p> <div id=\"myId\">...</div>"
|
||||
},
|
||||
"tags": [
|
||||
"browser",
|
||||
@ -3589,10 +3589,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "72db2aadee9327a4e794727fd39a254cc9cfcaa4f0819b2d03ad3c39c950264b",
|
||||
"hash": "bf4e5f5e31ce7057a18c2b54dd516ec647819b5a5246a93e883ade756ff39fd9",
|
||||
"firstSeen": "1529431078",
|
||||
"lastUpdated": "1565681352",
|
||||
"updateCount": 4,
|
||||
"lastUpdated": "1583481460",
|
||||
"updateCount": 5,
|
||||
"authorCount": 3
|
||||
}
|
||||
},
|
||||
@ -4777,10 +4777,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "362fddaa6244404741e84bca6fc442a101fdb642af53b299e8b9994d0d7162d8",
|
||||
"hash": "3db3faac666ee61ab86c70766d2ab5d1293ffd818da87edb971bfff7a366364a",
|
||||
"firstSeen": "1514801920",
|
||||
"lastUpdated": "1582057110",
|
||||
"updateCount": 73,
|
||||
"lastUpdated": "1583442609",
|
||||
"updateCount": 74,
|
||||
"authorCount": 7
|
||||
}
|
||||
},
|
||||
@ -5712,10 +5712,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "b031c3387ef66411ab5d295788eac4247ada5b4b068dda90603d3c973890bc26",
|
||||
"hash": "e8f820ce6da97eabde082ffb829c9fb700e85efc79bdebe883c67237269e3f52",
|
||||
"firstSeen": "1570824965",
|
||||
"lastUpdated": "1582057110",
|
||||
"updateCount": 40,
|
||||
"lastUpdated": "1583442609",
|
||||
"updateCount": 41,
|
||||
"authorCount": 4
|
||||
}
|
||||
},
|
||||
@ -6008,7 +6008,7 @@
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "pad.md",
|
||||
"text": "Pads a string on both sides with the specified character, if it's shorter than the specified length.\n\nUse `String.padStart()` and `String.padEnd()` to pad both sides of the given string.\nOmit the third argument, `char`, to use the whitespace character as the default padding character.\n\n",
|
||||
"text": "Pads a string on both sides with the specified character, if it's shorter than the specified length.\n\nUse `String.prototype.padStart()` and `String.prototype.padEnd()` to pad both sides of the given string.\nOmit the third argument, `char`, to use the whitespace character as the default padding character.\n\n",
|
||||
"codeBlocks": {
|
||||
"es6": "const pad = (str, length, char = ' ') =>\n str.padStart((str.length + length) / 2, char).padEnd(length, char);",
|
||||
"es5": "var pad = function pad(str, length) {\n var _char = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : ' ';\n\n return str.padStart((str.length + length) / 2, _char).padEnd(length, _char);\n};",
|
||||
@ -6020,10 +6020,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "04a1e9e83ff8bb138a86e7bb060a19de2593bc4054ce48cfef511eec1052edbe",
|
||||
"hash": "d330cea0a63c1e50ca7f0203024ab7a7994e15cdaa04361e8a99feaf71ffb42f",
|
||||
"firstSeen": "1519465887",
|
||||
"lastUpdated": "1565681352",
|
||||
"updateCount": 4,
|
||||
"lastUpdated": "1583481487",
|
||||
"updateCount": 5,
|
||||
"authorCount": 3
|
||||
}
|
||||
},
|
||||
@ -6269,7 +6269,7 @@
|
||||
"codeBlocks": {
|
||||
"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};",
|
||||
"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": [
|
||||
"function",
|
||||
@ -6278,10 +6278,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "0eb844801e767edcaa6a882a6dce4b5b1dadecb53a92d6ec259d36c57b6a3dd0",
|
||||
"hash": "a2b9ac4f1209c3791caa6f40f0d041acd75514e9ee8909f2e3833635f357c0bd",
|
||||
"firstSeen": "1517069864",
|
||||
"lastUpdated": "1582057110",
|
||||
"updateCount": 98,
|
||||
"lastUpdated": "1583442609",
|
||||
"updateCount": 99,
|
||||
"authorCount": 5
|
||||
}
|
||||
},
|
||||
@ -6922,10 +6922,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "069472d018c3102412dafc2ae8ec6e9396e53c01d0073079f2e3f1ac3c99b6e9",
|
||||
"hash": "c1542907e6295eb81df918174c247a65d73c8daccc56769f2eb32d609b7846fc",
|
||||
"firstSeen": "1513521691",
|
||||
"lastUpdated": "1582057110",
|
||||
"updateCount": 94,
|
||||
"lastUpdated": "1583442609",
|
||||
"updateCount": 95,
|
||||
"authorCount": 6
|
||||
}
|
||||
},
|
||||
@ -7271,11 +7271,11 @@
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "setStyle.md",
|
||||
"text": "Sets the value of a CSS rule for the specified element.\n\nUse `element.style` to set the value of the CSS rule for the specified element to `val`.\n\n",
|
||||
"text": "Sets the value of a CSS rule for the specified HTML element.\n\nUse `element.style` to set the value of the CSS rule for the specified element to `val`.\n\n",
|
||||
"codeBlocks": {
|
||||
"es6": "const setStyle = (el, ruleName, val) => (el.style[ruleName] = val);",
|
||||
"es5": "var setStyle = function setStyle(el, ruleName, val) {\n return el.style[ruleName] = val;\n};",
|
||||
"example": "setStyle(document.querySelector('p'), 'font-size', '20px'); // The first <p> element on the page will have a font-size of 20px"
|
||||
"example": "setStyle(document.querySelector('p'), 'font-size', '20px');\n// The first <p> element on the page will have a font-size of 20px"
|
||||
},
|
||||
"tags": [
|
||||
"browser",
|
||||
@ -7283,10 +7283,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "8f531d87240d659970223c06c464bb1434fb3096e365d48dccb5c386a39e1ac4",
|
||||
"hash": "3af57aa88e446dcfa4f1a7a8a434b541445e91cb366f0c56184c5e09f7c961cb",
|
||||
"firstSeen": "1514498897",
|
||||
"lastUpdated": "1565681352",
|
||||
"updateCount": 5,
|
||||
"lastUpdated": "1583481460",
|
||||
"updateCount": 6,
|
||||
"authorCount": 3
|
||||
}
|
||||
},
|
||||
@ -7438,10 +7438,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "24b93b68a59b49f245590930fed6fb82e286ce09f90e292466cde63c1784c347",
|
||||
"hash": "6dd4c6a51d2c80fa4768c95ae01c16a8359c4140bcad28c7fde0cecd72d7d3e2",
|
||||
"firstSeen": "1514645161",
|
||||
"lastUpdated": "1582057110",
|
||||
"updateCount": 39,
|
||||
"lastUpdated": "1583442609",
|
||||
"updateCount": 40,
|
||||
"authorCount": 5
|
||||
}
|
||||
},
|
||||
@ -8199,7 +8199,7 @@
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "toDecimalMark.md",
|
||||
"text": "Use `toLocaleString()` to convert a float-point arithmetic to the [Decimal mark](https://en.wikipedia.org/wiki/Decimal_mark) form. It makes a comma separated string from a number.\n\n",
|
||||
"text": "Converts a number to a decimal mark formatted string.\n\nUse `Number.prototype.toLocaleString()` to convert the numbre to decimal mark format.\n\n",
|
||||
"codeBlocks": {
|
||||
"es6": "const toDecimalMark = num => num.toLocaleString('en-US');",
|
||||
"es5": "var toDecimalMark = function toDecimalMark(num) {\n return num.toLocaleString('en-US');\n};",
|
||||
@ -8212,10 +8212,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "426eb2319298548df80de3db701eb3c130abd4ff9613a87bd2ae55f76aae7039",
|
||||
"hash": "22c2a4835f37334d3b5fa5f83bbaaddc642feb71c1868f514928c656e250abe6",
|
||||
"firstSeen": "1513866591",
|
||||
"lastUpdated": "1565681352",
|
||||
"updateCount": 15,
|
||||
"lastUpdated": "1583481487",
|
||||
"updateCount": 16,
|
||||
"authorCount": 7
|
||||
}
|
||||
},
|
||||
@ -8225,11 +8225,11 @@
|
||||
"type": "snippet",
|
||||
"attributes": {
|
||||
"fileName": "toggleClass.md",
|
||||
"text": "Toggle a class for an element.\n\nUse `element.classList.toggle()` to toggle the specified class for the element.\n\n",
|
||||
"text": "Toggles a class for an HTML element.\n\nUse `element.classList.toggle()` to toggle the specified class for the element.\n\n",
|
||||
"codeBlocks": {
|
||||
"es6": "const toggleClass = (el, className) => el.classList.toggle(className);",
|
||||
"es5": "var toggleClass = function toggleClass(el, className) {\n return el.classList.toggle(className);\n};",
|
||||
"example": "toggleClass(document.querySelector('p.special'), 'special'); // The paragraph will not have the 'special' class anymore"
|
||||
"example": "toggleClass(document.querySelector('p.special'), 'special');\n// The paragraph will not have the 'special' class anymore"
|
||||
},
|
||||
"tags": [
|
||||
"browser",
|
||||
@ -8237,10 +8237,10 @@
|
||||
]
|
||||
},
|
||||
"meta": {
|
||||
"hash": "994b3e4bd75982d26fef1b3812890b90118c8d89aec6e8a666ce7e132c382081",
|
||||
"hash": "34abfb52d68cbd59aa575d0a1620312798264526dfa006f3bf52883e92e41105",
|
||||
"firstSeen": "1514497593",
|
||||
"lastUpdated": "1565681352",
|
||||
"updateCount": 5,
|
||||
"lastUpdated": "1583481460",
|
||||
"updateCount": 6,
|
||||
"authorCount": 3
|
||||
}
|
||||
},
|
||||
@ -8366,9 +8366,9 @@
|
||||
"meta": {
|
||||
"hash": "b893c5ab5d118c46dc7b673413adbeddd967093c36225eb31cf446c95de0ff39",
|
||||
"firstSeen": "1515424366",
|
||||
"lastUpdated": "1583442408",
|
||||
"updateCount": 4,
|
||||
"authorCount": 2
|
||||
"lastUpdated": "1583442609",
|
||||
"updateCount": 5,
|
||||
"authorCount": 3
|
||||
}
|
||||
},
|
||||
{
|
||||
|
||||
@ -9,6 +9,7 @@ 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.
|
||||
|
||||
```js
|
||||
|
||||
const dig = (obj, target) =>
|
||||
target in obj
|
||||
? obj[target]
|
||||
|
||||
@ -11,6 +11,7 @@ Otherwise, return the product of `n` and the factorial of `n - 1`.
|
||||
Throws an exception if `n` is a negative number.
|
||||
|
||||
```js
|
||||
|
||||
const factorial = n =>
|
||||
n < 0
|
||||
? (() => {
|
||||
|
||||
@ -8,6 +8,7 @@ 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.
|
||||
|
||||
```js
|
||||
|
||||
const getMeridiemSuffixOfInteger = num =>
|
||||
num === 0 || num === 24
|
||||
? 12 + 'am'
|
||||
|
||||
@ -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.
|
||||
|
||||
```js
|
||||
|
||||
const join = (arr, separator = ',', end = separator) =>
|
||||
arr.reduce(
|
||||
(acc, val, i) =>
|
||||
|
||||
@ -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.
|
||||
|
||||
```js
|
||||
|
||||
const objectToQueryString = queryParameters => {
|
||||
return queryParameters
|
||||
? Object.entries(queryParameters).reduce((queryString, [key, val], index) => {
|
||||
|
||||
@ -14,14 +14,13 @@ const pipeAsyncFunctions = (...fns) => arg => fns.reduce((p, f) => p.then(f), Pr
|
||||
```
|
||||
|
||||
```js
|
||||
|
||||
const sum = pipeAsyncFunctions(
|
||||
x => x + 1,
|
||||
x => new Promise(resolve => setTimeout(() => resolve(x + 2), 1000)),
|
||||
x => x + 3,
|
||||
async x => (await x) + 4
|
||||
);
|
||||
(async() => {
|
||||
(async () => {
|
||||
console.log(await sum(5)); // 15 (after one second)
|
||||
})();
|
||||
```
|
||||
|
||||
@ -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`).
|
||||
|
||||
```js
|
||||
|
||||
const remove = (arr, func) =>
|
||||
Array.isArray(arr)
|
||||
? 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.
|
||||
|
||||
```js
|
||||
|
||||
const size = val =>
|
||||
Array.isArray(val)
|
||||
? val.length
|
||||
|
||||
Reference in New Issue
Block a user