Initial commit
[yaffs-website] / node_modules / grunt-contrib-watch / node_modules / lodash / internal / replaceHolders.js
1 /** Used as the internal argument placeholder. */
2 var PLACEHOLDER = '__lodash_placeholder__';
3
4 /**
5  * Replaces all `placeholder` elements in `array` with an internal placeholder
6  * and returns an array of their indexes.
7  *
8  * @private
9  * @param {Array} array The array to modify.
10  * @param {*} placeholder The placeholder to replace.
11  * @returns {Array} Returns the new array of placeholder indexes.
12  */
13 function replaceHolders(array, placeholder) {
14   var index = -1,
15       length = array.length,
16       resIndex = -1,
17       result = [];
18
19   while (++index < length) {
20     if (array[index] === placeholder) {
21       array[index] = PLACEHOLDER;
22       result[++resIndex] = index;
23     }
24   }
25   return result;
26 }
27
28 module.exports = replaceHolders;