From bbff7403fbf46f9ad92240ac213df8d30ef31b64 Mon Sep 17 00:00:00 2001 From: Florian Dold Date: Thu, 20 Sep 2018 02:56:13 +0200 Subject: update packages --- node_modules/lodash/invert.js | 15 +++++++++++++++ 1 file changed, 15 insertions(+) (limited to 'node_modules/lodash/invert.js') diff --git a/node_modules/lodash/invert.js b/node_modules/lodash/invert.js index 21d10aba3..8c4795097 100644 --- a/node_modules/lodash/invert.js +++ b/node_modules/lodash/invert.js @@ -2,6 +2,16 @@ var constant = require('./constant'), createInverter = require('./_createInverter'), identity = require('./identity'); +/** Used for built-in method references. */ +var objectProto = Object.prototype; + +/** + * Used to resolve the + * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring) + * of values. + */ +var nativeObjectToString = objectProto.toString; + /** * Creates an object composed of the inverted keys and values of `object`. * If `object` contains duplicate values, subsequent values overwrite @@ -21,6 +31,11 @@ var constant = require('./constant'), * // => { '1': 'c', '2': 'b' } */ var invert = createInverter(function(result, value, key) { + if (value != null && + typeof value.toString != 'function') { + value = nativeObjectToString.call(value); + } + result[value] = key; }, constant(identity)); -- cgit v1.2.3