Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / indexOfNaN.js
1 /**
2  * Gets the index at which the first occurrence of `NaN` is found in `array`.
3  *
4  * @private
5  * @param {Array} array The array to search.
6  * @param {number} fromIndex The index to search from.
7  * @param {boolean} [fromRight] Specify iterating from right to left.
8  * @returns {number} Returns the index of the matched `NaN`, else `-1`.
9  */
10 function indexOfNaN(array, fromIndex, fromRight) {
11   var length = array.length,
12       index = fromIndex + (fromRight ? 0 : -1);
13
14   while ((fromRight ? index-- : ++index < length)) {
15     var other = array[index];
16     if (other !== other) {
17       return index;
18     }
19   }
20   return -1;
21 }
22
23 module.exports = indexOfNaN;