diff options
author | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2018-09-20 02:56:13 +0200 |
commit | bbff7403fbf46f9ad92240ac213df8d30ef31b64 (patch) | |
tree | c58400ec5124da1c7d56b01aea83309f80a56c3b /node_modules/lodash/invertBy.js | |
parent | 003fb34971cf63466184351b4db5f7c67df4f444 (diff) |
update packages
Diffstat (limited to 'node_modules/lodash/invertBy.js')
-rw-r--r-- | node_modules/lodash/invertBy.js | 12 |
1 files changed, 12 insertions, 0 deletions
diff --git a/node_modules/lodash/invertBy.js b/node_modules/lodash/invertBy.js index e5ba0f709..3f4f7e532 100644 --- a/node_modules/lodash/invertBy.js +++ b/node_modules/lodash/invertBy.js @@ -8,6 +8,13 @@ var objectProto = Object.prototype; var hasOwnProperty = objectProto.hasOwnProperty; /** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + +/** * This method is like `_.invert` except that the inverted object is generated * from the results of running each element of `object` thru `iteratee`. The * corresponding inverted value of each inverted key is an array of keys @@ -34,6 +41,11 @@ var hasOwnProperty = objectProto.hasOwnProperty; * // => { 'group1': ['a', 'c'], 'group2': ['b'] } */ var invertBy = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + if (hasOwnProperty.call(result, value)) { result[value].push(key); } else { |