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

_createBaseFor.js 648B

12345678910111213141516171819202122232425
  1. /**
  2. * Creates a base function for methods like `_.forIn` and `_.forOwn`.
  3. *
  4. * @private
  5. * @param {boolean} [fromRight] Specify iterating from right to left.
  6. * @returns {Function} Returns the new base function.
  7. */
  8. function createBaseFor(fromRight) {
  9. return function(object, iteratee, keysFunc) {
  10. var index = -1,
  11. iterable = Object(object),
  12. props = keysFunc(object),
  13. length = props.length;
  14. while (length--) {
  15. var key = props[fromRight ? length : ++index];
  16. if (iteratee(iterable[key], key, iterable) === false) {
  17. break;
  18. }
  19. }
  20. return object;
  21. };
  22. }
  23. module.exports = createBaseFor;