From c1bc3f9f714f699dbf1ba4304bef676a308d2a08 Mon Sep 17 00:00:00 2001
From: 30secondsofcode <30secondsofcode@gmail.com>
Date: Thu, 18 Jan 2018 15:48:23 +0000
Subject: [PATCH] Travis build: 1306
---
README.md | 67 +++++++++++++++++++++++--------------------------
docs/index.html | 24 +++++++++---------
2 files changed, 43 insertions(+), 48 deletions(-)
diff --git a/README.md b/README.md
index be766e7a6..0896ddf02 100644
--- a/README.md
+++ b/README.md
@@ -275,6 +275,7 @@ average(1, 2, 3);
* [`cleanObj`](#cleanobj)
* [`equals`](#equals-)
* [`functions`](#functions)
+* [`get`](#get)
* [`invertKeyValues`](#invertkeyvalues)
* [`lowercaseKeys`](#lowercasekeys)
* [`mapKeys`](#mapkeys)
@@ -371,15 +372,6 @@ average(1, 2, 3);
-### _Uncategorized_
-
-
-View contents
-
-* [`get`](#get)
-
-
-
---
## 🔌 Adapter
@@ -4263,6 +4255,36 @@ functions(new Foo(), true); // ['a', 'b', 'c']
[⬆ Back to top](#table-of-contents)
+### get
+
+Retrieve a set of properties indicated by the given selectors from an object.
+
+Use `Array.map()` for each selector, `String.replace()` to replace square brackets with dots, `String.split('.')` to split each selector, `Array.filter()` to remove empty values and `Array.reduce()` to get the value indicated by it.
+
+```js
+const get = (from, ...selectors) =>
+ [...selectors].map(s =>
+ s
+ .replace(/\[([^\[\]]*)\]/g, '.$1.')
+ .split('.')
+ .filter(t => t !== '')
+ .reduce((prev, cur) => prev && prev[cur], from)
+ );
+```
+
+
+Examples
+
+```js
+const obj = { selector: { to: { val: 'val to select' } }, target: [1, 2, { a: 'test' }] };
+get(obj, 'selector.to.val', 'target[0]', 'target[2].a'); // ['val to select', 1, 'test']
+```
+
+
+
+ [⬆ Back to top](#table-of-contents)
+
+
### invertKeyValues
Inverts the key-value pairs of an object, without mutating it.
@@ -6183,33 +6205,6 @@ yesNo('Foo', true); // true
[⬆ Back to top](#table-of-contents)
----
- ## _Uncategorized_
-
-### get
-
-Retrieve a set of properties indicated by the given selectors from an object.
-
-Use `Array.map()` for each selector, `String.replace()` to replace square brackets with dots, `String.split('.')` to split each selector, `Array.filter()` to remove empty values and `Array.reduce()` to get the value indicated by it.
-
-```js
-const get = (from, ...selectors) =>
- [...selectors].map(s =>
- s
- .replace(/\[([^\[\]]*)\]/g, '.$1.')
- .split('.')
- .filter(t => t !== '')
- .reduce((prev, cur) => prev && prev[cur], from)
- );
-```
-
-```js
-const obj = { selector: { to: { val: 'val to select' } }, target: [1, 2, { a: 'test' }] };
-get(obj, 'selector.to.val', 'target[0]', 'target[2].a'); // ['val to select', 1, 'test']
-```
-
- [⬆ back to top](#table-of-contents)
-
## Collaborators
diff --git a/docs/index.html b/docs/index.html
index 6e3b2d4bc..60ef59e4e 100644
--- a/docs/index.html
+++ b/docs/index.html
@@ -50,7 +50,7 @@
scrollToTop();
}
}, false);
- }
30 seconds of code Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less. Search for snippet...
Adapter call collectInto flip pipeFunctions promisify spreadOver Array chunk compact countBy countOccurrences deepFlatten difference differenceWith dropElements dropRight everyNth filterNonUnique findLast flatten forEachRight groupBy head indexOfAll initial initialize2DArray initializeArrayWithRange initializeArrayWithRangeRight initializeArrayWithValues intersection isSorted join last longestItem mapObject maxN minN nthElement partition pick pull pullAtIndex pullAtValue reducedFilter remove sample sampleSize shuffle similarity sortedIndex symmetricDifference tail take takeRight union uniqueElements without zip zipObject Browser arrayToHtmlList bottomVisible copyToClipboard createElement createEventHub currentURL detectDeviceType elementIsVisibleInViewport getScrollPosition getStyle hasClass hashBrowser hide httpsRedirect observeMutations off on onUserInputChange redirect runAsync scrollToTop setStyle show toggleClass UUIDGeneratorBrowser Date formatDuration getDaysDiffBetweenDates tomorrow Function chainAsync compose curry defer functionName memoize negate once runPromisesInSeries sleep Math average averageBy clampNumber digitize distance elo factorial fibonacci gcd geometricProgression hammingDistance inRange isDivisible isEven isPrime lcm luhnCheck maxBy median minBy percentile powerset primes randomIntArrayInRange randomIntegerInRange randomNumberInRange round sdbm standardDeviation sum sumBy sumPower toSafeInteger Node atob btoa colorize hasFlags hashNode isTravisCI JSONToFile readFileLines untildify UUIDGeneratorNode Object cleanObj equals functions invertKeyValues lowercaseKeys mapKeys mapValues merge objectFromPairs objectToPairs orderBy shallowClone size transform truthCheckCollection String anagrams byteSize capitalize capitalizeEveryWord decapitalize escapeHTML escapeRegExp fromCamelCase isAbsoluteURL isLowerCase isUpperCase mask palindrome pluralize reverseString sortCharactersInString splitLines toCamelCase toKebabCase toSnakeCase truncateString unescapeHTML URLJoin words Type getType is isArrayLike isBoolean isFunction isNil isNull isNumber isObject isPrimitive isPromiseLike isString isSymbol isUndefined isValidJSON Utility cloneRegExp coalesce coalesceFactory extendHex getURLParameters hexToRGB httpGet httpPost parseCookie prettyBytes randomHexColorCode RGBToHex serializeCookie timeTaken toDecimalMark toOrdinalSuffix validateNumber yesNo Uncategorized get Adapter call Given a key and a set of arguments, call them when given a context. Primarily useful in composition.
Use a closure to call a stored key with stored arguments.
const call = ( key, ... args) => context => context[ key]( ... args);
+ } 30 seconds of code Curated collection of useful JavaScript snippets that you can understand in 30 seconds or less. Search for snippet...
Adapter call collectInto flip pipeFunctions promisify spreadOver Array chunk compact countBy countOccurrences deepFlatten difference differenceWith dropElements dropRight everyNth filterNonUnique findLast flatten forEachRight groupBy head indexOfAll initial initialize2DArray initializeArrayWithRange initializeArrayWithRangeRight initializeArrayWithValues intersection isSorted join last longestItem mapObject maxN minN nthElement partition pick pull pullAtIndex pullAtValue reducedFilter remove sample sampleSize shuffle similarity sortedIndex symmetricDifference tail take takeRight union uniqueElements without zip zipObject Browser arrayToHtmlList bottomVisible copyToClipboard createElement createEventHub currentURL detectDeviceType elementIsVisibleInViewport getScrollPosition getStyle hasClass hashBrowser hide httpsRedirect observeMutations off on onUserInputChange redirect runAsync scrollToTop setStyle show toggleClass UUIDGeneratorBrowser Date formatDuration getDaysDiffBetweenDates tomorrow Function chainAsync compose curry defer functionName memoize negate once runPromisesInSeries sleep Math average averageBy clampNumber digitize distance elo factorial fibonacci gcd geometricProgression hammingDistance inRange isDivisible isEven isPrime lcm luhnCheck maxBy median minBy percentile powerset primes randomIntArrayInRange randomIntegerInRange randomNumberInRange round sdbm standardDeviation sum sumBy sumPower toSafeInteger Node atob btoa colorize hasFlags hashNode isTravisCI JSONToFile readFileLines untildify UUIDGeneratorNode Object cleanObj equals functions get invertKeyValues lowercaseKeys mapKeys mapValues merge objectFromPairs objectToPairs orderBy shallowClone size transform truthCheckCollection String anagrams byteSize capitalize capitalizeEveryWord decapitalize escapeHTML escapeRegExp fromCamelCase isAbsoluteURL isLowerCase isUpperCase mask palindrome pluralize reverseString sortCharactersInString splitLines toCamelCase toKebabCase toSnakeCase truncateString unescapeHTML URLJoin words Type getType is isArrayLike isBoolean isFunction isNil isNull isNumber isObject isPrimitive isPromiseLike isString isSymbol isUndefined isValidJSON Utility cloneRegExp coalesce coalesceFactory extendHex getURLParameters hexToRGB httpGet httpPost parseCookie prettyBytes randomHexColorCode RGBToHex serializeCookie timeTaken toDecimalMark toOrdinalSuffix validateNumber yesNo Adapter call Given a key and a set of arguments, call them when given a context. Primarily useful in composition.
Use a closure to call a stored key with stored arguments.
const call = ( key, ... args) => context => context[ key]( ... args);
Show examples Promise. resolve ([ 1 , 2 , 3 ])
. then ( call ( 'map' , x => 2 * x))
. then ( console. log);
@@ -951,6 +951,16 @@ console. log<
Foo. prototype. c = () => 3 ;
functions ( new Foo ());
functions ( new Foo (), true );
+ 📋 Copy to clipboard get Retrieve a set of properties indicated by the given selectors from an object.
Use Array.map() for each selector, String.replace() to replace square brackets with dots, String.split('.') to split each selector, Array.filter() to remove empty values and Array.reduce() to get the value indicated by it.
const get = ( from , ... selectors) =>
+ [ ... selectors]. map ( s =>
+ s
+ . replace ( /\[([^\[\]]*)\]/g , '.$1.' )
+ . split ( '.' )
+ . filter ( t => t !== '' )
+ . reduce (( prev, cur) => prev && prev[ cur], from )
+ );
+Show examples const obj = { selector: { to: { val: 'val to select' } }, target: [ 1 , 2 , { a: 'test' }] };
+get ( obj, 'selector.to.val' , 'target[0]' , 'target[2].a' );
📋 Copy to clipboard invertKeyValues Inverts the key-value pairs of an object, without mutating it.
Use Object.keys() and Array.reduce() to invert the key-value pairs of an object.
const invertKeyValues = obj =>
Object. keys ( obj). reduce (( acc, key) => {
acc[ obj[ key]] = key;
@@ -1438,14 +1448,4 @@ Logs: {
yesNo ( 'yes' );
yesNo ( 'No' );
yesNo ( 'Foo' , true );
-📋 Copy to clipboard Uncategorized get Retrieve a set of properties indicated by the given selectors from an object.
Use Array.map() for each selector, String.replace() to replace square brackets with dots, String.split('.') to split each selector, Array.filter() to remove empty values and Array.reduce() to get the value indicated by it.
const get = ( from , ... selectors) =>
- [ ... selectors]. map ( s =>
- s
- . replace ( /\[([^\[\]]*)\]/g , '.$1.' )
- . split ( '.' )
- . filter ( t => t !== '' )
- . reduce (( prev, cur) => prev && prev[ cur], from )
- );
-Show examples const obj = { selector: { to: { val: 'val to select' } }, target: [ 1 , 2 , { a: 'test' }] };
-get ( obj, 'selector.to.val' , 'target[0]' , 'target[2].a' );
-📋 Copy to clipboard ↑