You can not select more than 25 topics
			Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
		
		
		
		
			
				
					22 lines
				
				469 B
			
		
		
			
		
	
	
					22 lines
				
				469 B
			| 
								 
											4 years ago
										 
									 | 
							
								/**
							 | 
						||
| 
								 | 
							
								 * 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;
							 |