From becea1db5e839e37ae507c419ba767b88627df0e Mon Sep 17 00:00:00 2001 From: 30secondsofcode <30secondsofcode@gmail.com> Date: Thu, 21 Nov 2019 20:09:07 +0000 Subject: [PATCH] Travis build: 1576 --- README.md | 57 +- snippet_data/snippetList.json | 34 +- snippet_data/snippets.json | 1458 ++++++++++++------------ snippets/checkProp.md | 1 + snippets/deepClone.md | 5 +- snippets/deepMapKeys.md | 5 +- snippets/dig.md | 7 +- snippets/factorial.md | 9 +- snippets/getMeridiemSuffixOfInteger.md | 9 +- snippets/join.md | 5 +- snippets/objectToQueryString.md | 9 +- snippets/pipeAsyncFunctions.md | 3 +- test/_30s.js | 42 +- vscode_snippets/snippets.json | 50 +- 14 files changed, 849 insertions(+), 845 deletions(-) diff --git a/README.md b/README.md index 3495d0902..18def8a0e 100644 --- a/README.md +++ b/README.md @@ -680,7 +680,7 @@ const sum = pipeAsyncFunctions( x => x + 3, async x => (await x) + 4 ); -(async() => { +(async () => { console.log(await sum(5)); // 15 (after one second) })(); ``` @@ -1769,8 +1769,8 @@ const join = (arr, separator = ',', end = separator) => i === arr.length - 2 ? acc + val + end : i === arr.length - 1 - ? acc + val - : acc + val + separator, + ? acc + val + : acc + val + separator, '' ); ``` @@ -2037,10 +2037,10 @@ partition(users, o => o.active); // [[{ 'user': 'fred', 'age': 40, 'active': ### permutations ![advanced](/advanced.svg) -⚠️ **WARNING**: This function's execution time increases exponentially with each array element. Anything more than 8 to 10 entries will cause your browser to hang as it tries to solve all the different combinations. - Generates all permutations of an array's elements (contains duplicates). +⚠️ **WARNING**: This function's execution time increases exponentially with each array element. Anything more than 8 to 10 entries will cause your browser to hang as it tries to solve all the different combinations. + Use recursion. For each element in the given array, create all the partial permutations for the rest of its elements. Use `Array.prototype.map()` to combine the element with each partial permutation, then `Array.prototype.reduce()` to combine all permutations in one array. @@ -3223,11 +3223,11 @@ bottomVisible(); // true ### copyToClipboard ![advanced](/advanced.svg) -⚠️ **NOTICE:** The same functionality can be easily implemented by using the new asynchronous Clipboard API, which is still experimental but should be used in the future instead of this snippet. Find out more about it [here](https://github.com/w3c/clipboard-apis/blob/master/explainer.adoc#writing-to-the-clipboard). - Copy a string to the clipboard. Only works as a result of user action (i.e. inside a `click` event listener). +⚠️ **NOTICE:** The same functionality can be easily implemented by using the new asynchronous Clipboard API, which is still experimental but should be used in the future instead of this snippet. Find out more about it [here](https://github.com/w3c/clipboard-apis/blob/master/explainer.adoc#writing-to-the-clipboard). + Create a new `