aboutsummaryrefslogtreecommitdiff
path: root/node_modules/lodash/invertBy.js
diff options
context:
space:
mode:
Diffstat (limited to 'node_modules/lodash/invertBy.js')
-rw-r--r--node_modules/lodash/invertBy.js12
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 {