mirror of
				https://github.com/taixingyiji/openit.git
				synced 2025-11-04 14:32:14 +00:00 
			
		
		
		
	
		
			
				
	
	
		
			22 lines
		
	
	
		
			469 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
			
		
		
	
	
			22 lines
		
	
	
		
			469 B
		
	
	
	
		
			JavaScript
		
	
	
	
	
	
/**
 | 
						|
 * Gets the number of `placeholder` occurrences in `array`.
 | 
						|
 *
 | 
						|
 * @private
 | 
						|
 * @param {Array} array The array to inspect.
 | 
						|
 * @param {*} placeholder The placeholder to search for.
 | 
						|
 * @returns {number} Returns the placeholder count.
 | 
						|
 */
 | 
						|
function countHolders(array, placeholder) {
 | 
						|
  var length = array.length,
 | 
						|
      result = 0;
 | 
						|
 | 
						|
  while (length--) {
 | 
						|
    if (array[length] === placeholder) {
 | 
						|
      ++result;
 | 
						|
    }
 | 
						|
  }
 | 
						|
  return result;
 | 
						|
}
 | 
						|
 | 
						|
module.exports = countHolders;
 |