You can not select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

27 regels
780 B

4 jaren geleden
  1. var apply = require('./_apply'),
  2. arrayMap = require('./_arrayMap'),
  3. baseIteratee = require('./_baseIteratee'),
  4. baseRest = require('./_baseRest'),
  5. baseUnary = require('./_baseUnary'),
  6. flatRest = require('./_flatRest');
  7. /**
  8. * Creates a function like `_.over`.
  9. *
  10. * @private
  11. * @param {Function} arrayFunc The function to iterate over iteratees.
  12. * @returns {Function} Returns the new over function.
  13. */
  14. function createOver(arrayFunc) {
  15. return flatRest(function(iteratees) {
  16. iteratees = arrayMap(iteratees, baseUnary(baseIteratee));
  17. return baseRest(function(args) {
  18. var thisArg = this;
  19. return arrayFunc(iteratees, function(iteratee) {
  20. return apply(iteratee, thisArg, args);
  21. });
  22. });
  23. });
  24. }
  25. module.exports = createOver;