sortbyfrequency
v1.0.11
Published
Sort an array based on the Frequency of the elements
Downloads
7
Maintainers
Readme
Sort an array by the frequency of elements
Installing
npm i sortbyfrequency;
Importing
import sortByFrequency from "sortbyfrequency"; //ES6
const sortByFrequency = require("sortbyfrequency"); //JS
Usage:
import sortByFrequency from "sortbyfrequency"; //ES6
const sortByFrequency = require("sortbyfrequency"); //JS
let sorted = sortByFrequency(["a", "b", "b", "c", "b", "a"]);
console.log(sorted); //['b', 'a', 'c']