Lobashov_Ivan_PIBD-21_IP/Lab2/node_modules/lodash/_countHolders.js

22 lines
469 B
JavaScript
Raw Permalink Normal View History

2024-01-10 22:39:31 +04:00
/**
* 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;