array-count-values return an object of values from an array as keys and their count as value.
Install with npm:
npm i array-count-values
const arrayCountValues = require("array-count-values");
const arr = [1, "hello", 1, "world", "hello"];
arrayCountValues(arr); // => { '1': 2, hello: 2, world: 1 }
Nabed Khan
Copyright (c) 2022 Released under the MIT license