locutus
Version:
Locutus other languages' standard libraries to JavaScript for fun and educational purposes
16 lines (15 loc) • 653 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.countOf = countOf;
const _operator_ts_1 = require("../_helpers/_operator.js");
function countOf(a, b) {
// discuss at: https://locutus.io/python/operator/countOf/
// parity verified: Python 3.12
// original by: Kevin van Zonneveld (https://kvz.io)
// note 1: Counts occurrences in strings and arrays like Python's operator.countOf.
// example 1: countOf([1, 2, 1, 1], 1)
// returns 1: 3
// example 2: countOf('banana', 'a')
// returns 2: 3
return (0, _operator_ts_1.pythonCountOf)(a, b);
}