|
1234567891011121314151617181920212223242526272829303132333435363738394041424344454647484950515253545556 |
- var baseIteratee = require('./_baseIteratee'),
- createInverter = require('./_createInverter');
-
-
- var objectProto = Object.prototype;
-
-
- var hasOwnProperty = objectProto.hasOwnProperty;
-
-
- var nativeObjectToString = objectProto.toString;
-
-
- 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 {
- result[value] = [key];
- }
- }, baseIteratee);
-
- module.exports = invertBy;
|