Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / isIterateeCall.js
1 var isArrayLike = require('./isArrayLike'),
2     isIndex = require('./isIndex'),
3     isObject = require('../lang/isObject');
4
5 /**
6  * Checks if the provided 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, else `false`.
13  */
14 function isIterateeCall(value, index, object) {
15   if (!isObject(object)) {
16     return false;
17   }
18   var type = typeof index;
19   if (type == 'number'
20       ? (isArrayLike(object) && isIndex(index, object.length))
21       : (type == 'string' && index in object)) {
22     var other = object[index];
23     return value === value ? (value === other) : (other !== other);
24   }
25   return false;
26 }
27
28 module.exports = isIterateeCall;