Repositorio del curso CCOM4030 el semestre B91 del proyecto Artesanías con el Instituto de Cultura

_createOver.js 780B

123456789101112131415161718192021222324252627
  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;