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

_isIterateeCall.js 877B

123456789101112131415161718192021222324252627282930
  1. var eq = require('./eq'),
  2. isArrayLike = require('./isArrayLike'),
  3. isIndex = require('./_isIndex'),
  4. isObject = require('./isObject');
  5. /**
  6. * Checks if the given arguments are from an iteratee call.
  7. *
  8. * @private
  9. * @param {*} value The potential iteratee value argument.
  10. * @param {*} index The potential iteratee index or key argument.
  11. * @param {*} object The potential iteratee object argument.
  12. * @returns {boolean} Returns `true` if the arguments are from an iteratee call,
  13. * else `false`.
  14. */
  15. function isIterateeCall(value, index, object) {
  16. if (!isObject(object)) {
  17. return false;
  18. }
  19. var type = typeof index;
  20. if (type == 'number'
  21. ? (isArrayLike(object) && isIndex(index, object.length))
  22. : (type == 'string' && index in object)
  23. ) {
  24. return eq(object[index], value);
  25. }
  26. return false;
  27. }
  28. module.exports = isIterateeCall;