_createInverter.js 497 B

123456789101112131415161718
  1. var baseInverter = require('./_baseInverter');
  2. /**
  3. * Creates a function like `_.invertBy`.
  4. *
  5. * @private
  6. * @param {Function} setter The function to set accumulator values.
  7. * @param {Function} toIteratee The function to resolve iteratees.
  8. * @returns {Function} Returns the new inverter function.
  9. */
  10. function createInverter(setter, toIteratee) {
  11. return function(object, iteratee) {
  12. return baseInverter(object, setter, toIteratee(iteratee), {});
  13. };
  14. }
  15. module.exports = createInverter;