diff --git a/dist/_30s.esm.js b/dist/_30s.esm.js index 3c6b232dd..28d27e0c8 100644 --- a/dist/_30s.esm.js +++ b/dist/_30s.esm.js @@ -996,9 +996,9 @@ const reject = (pred, array) => array.filter((...args) => !pred(...args)); const remove = (arr, func) => Array.isArray(arr) ? arr.filter(func).reduce((acc, val) => { - arr.splice(arr.indexOf(val), 1); - return acc.concat(val); - }, []) + arr.splice(arr.indexOf(val), 1); + return acc.concat(val); + }, []) : []; const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, ''); const renameKeys = (keysMap, obj) => diff --git a/dist/_30s.js b/dist/_30s.js index 8d313cf32..da19f4aad 100644 --- a/dist/_30s.js +++ b/dist/_30s.js @@ -1002,9 +1002,9 @@ const remove = (arr, func) => Array.isArray(arr) ? arr.filter(func).reduce((acc, val) => { - arr.splice(arr.indexOf(val), 1); - return acc.concat(val); - }, []) + arr.splice(arr.indexOf(val), 1); + return acc.concat(val); + }, []) : []; const removeNonASCII = str => str.replace(/[^\x20-\x7E]/g, ''); const renameKeys = (keysMap, obj) => diff --git a/snippet_data/snippetList.json b/snippet_data/snippetList.json index c88d1092a..ddbeefafe 100644 --- a/snippet_data/snippetList.json +++ b/snippet_data/snippetList.json @@ -386,7 +386,7 @@ "archived": false }, "meta": { - "hash": "1757665e21f074496ca23fcd89eea262546dbdab526fb6e281501fca8caaa42b" + "hash": "b9a0897aca121af7d0705cace7673c27b22ffab5e67890a3e1859b7f28df2500" } }, { @@ -1000,7 +1000,7 @@ "archived": false }, "meta": { - "hash": "6ab35042dbb8b16be8ea108cf5029b34ac9fb166ca331ad2ed6a52188f5b0ba3" + "hash": "0a1e7cfbab47f1f7f8aee9d413bd14f4b84de7672d2481ca4ad9fa6cc2581948" } }, { @@ -1014,7 +1014,7 @@ "archived": false }, "meta": { - "hash": "421ed9a64e720bd3ba5969e067f94a3d0c3f515b9e8af5ed420a9bbce48d75cb" + "hash": "cee5b129d807482ad41d47f12f4451471964bb5e8e8059cc32b05ffb62706438" } }, { @@ -3794,7 +3794,7 @@ "archived": false }, "meta": { - "hash": "2fd54c9fc1fb5b0a981df69501b518d5830ea77544d4d5290c7cc13745ca00ea" + "hash": "ec9cb9384817f84cf0bacd62a23b69b2304fa2cf0352b16d3950b21d48c04f11" } }, { diff --git a/snippet_data/snippets.json b/snippet_data/snippets.json index 7f2262b97..567213c10 100644 --- a/snippet_data/snippets.json +++ b/snippet_data/snippets.json @@ -568,7 +568,7 @@ }, "meta": { "archived": false, - "hash": "1757665e21f074496ca23fcd89eea262546dbdab526fb6e281501fca8caaa42b" + "hash": "b9a0897aca121af7d0705cace7673c27b22ffab5e67890a3e1859b7f28df2500" } }, { @@ -1463,7 +1463,7 @@ "type": "snippet", "attributes": { "fileName": "drop.md", - "text": "Returns a new array with `n` elements removed from the left.\n\nUse `Array.prototype.slice()` to slice the remove the specified number of elements from the left.", + "text": "Returns a new array with `n` elements removed from the left.\n\nUse `Array.prototype.slice()` to remove the specified number of elements from the left.", "codeBlocks": { "es6": "const drop = (arr, n = 1) => arr.slice(n);", "es5": "var drop = function drop(arr) {\n var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n return arr.slice(n);\n};", @@ -1476,7 +1476,7 @@ }, "meta": { "archived": false, - "hash": "6ab35042dbb8b16be8ea108cf5029b34ac9fb166ca331ad2ed6a52188f5b0ba3" + "hash": "0a1e7cfbab47f1f7f8aee9d413bd14f4b84de7672d2481ca4ad9fa6cc2581948" } }, { @@ -1484,7 +1484,7 @@ "type": "snippet", "attributes": { "fileName": "dropRight.md", - "text": "Returns a new array with `n` elements removed from the right.\n\nUse `Array.prototype.slice()` to slice the remove the specified number of elements from the right.", + "text": "Returns a new array with `n` elements removed from the right.\n\nUse `Array.prototype.slice()` to remove the specified number of elements from the right.", "codeBlocks": { "es6": "const dropRight = (arr, n = 1) => arr.slice(0, -n);", "es5": "var dropRight = function dropRight(arr) {\n var n = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 1;\n return arr.slice(0, -n);\n};", @@ -1497,7 +1497,7 @@ }, "meta": { "archived": false, - "hash": "421ed9a64e720bd3ba5969e067f94a3d0c3f515b9e8af5ed420a9bbce48d75cb" + "hash": "cee5b129d807482ad41d47f12f4451471964bb5e8e8059cc32b05ffb62706438" } }, { @@ -5575,7 +5575,7 @@ "fileName": "remove.md", "text": "Removes elements from an array for which the given function returns `false`.\n\nUse `Array.prototype.filter()` to find array elements that return truthy values and `Array.prototype.reduce()` to remove elements using `Array.prototype.splice()`.\nThe `func` is invoked with three arguments (`value, index, array`).", "codeBlocks": { - "es6": "const remove = (arr, func) =>\n Array.isArray(arr)\n ? arr.filter(func).reduce((acc, val) => {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, [])\n : [];", + "es6": "const remove = (arr, func) =>\n Array.isArray(arr)\n ? arr.filter(func).reduce((acc, val) => {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, [])\n : [];", "es5": "var remove = function remove(arr, func) {\n return Array.isArray(arr) ? arr.filter(func).reduce(function (acc, val) {\n arr.splice(arr.indexOf(val), 1);\n return acc.concat(val);\n }, []) : [];\n};", "example": "remove([1, 2, 3, 4], n => n % 2 === 0); // [2, 4]" }, @@ -5586,7 +5586,7 @@ }, "meta": { "archived": false, - "hash": "2fd54c9fc1fb5b0a981df69501b518d5830ea77544d4d5290c7cc13745ca00ea" + "hash": "ec9cb9384817f84cf0bacd62a23b69b2304fa2cf0352b16d3950b21d48c04f11" } }, { diff --git a/vscode_snippets/snippets.json b/vscode_snippets/snippets.json index b23f6fc14..f4487ba8c 100644 --- a/vscode_snippets/snippets.json +++ b/vscode_snippets/snippets.json @@ -648,14 +648,14 @@ "body": [ "const drop = (arr, n = 1) => arr.slice(n);" ], - "description": "Returns a new array with `n` elements removed from the left.\n\nUse `Array.prototype.slice()` to slice the remove the specified number of elements from the left" + "description": "Returns a new array with `n` elements removed from the left.\n\nUse `Array.prototype.slice()` to remove the specified number of elements from the left" }, "dropRight": { "prefix": "30s_dropRight", "body": [ "const dropRight = (arr, n = 1) => arr.slice(0, -n);" ], - "description": "Returns a new array with `n` elements removed from the right.\n\nUse `Array.prototype.slice()` to slice the remove the specified number of elements from the right" + "description": "Returns a new array with `n` elements removed from the right.\n\nUse `Array.prototype.slice()` to remove the specified number of elements from the right" }, "dropRightWhile": { "prefix": "30s_dropRightWhile", @@ -2513,9 +2513,9 @@ "const remove = (arr, func) =>", " Array.isArray(arr)", " ? arr.filter(func).reduce((acc, val) => {", - " arr.splice(arr.indexOf(val), 1);", - " return acc.concat(val);", - " }, [])", + " arr.splice(arr.indexOf(val), 1);", + " return acc.concat(val);", + " }, [])", " : [];" ], "description": "Removes elements from an array for which the given function returns `false`.\n\nUse `Array.prototype.filter()` to find array elements that return truthy values and `Array.prototype.reduce()` to remove elements using `Array.prototype.splice()`.\nThe `func` is invoked with three arguments (`value, index, array`)"