UNPKG

array-types-counter

Version:

Simple helper to obtain the count of different array item's types.

3 lines (2 loc) 497 B
"use strict";Object.defineProperty(exports,"__esModule",{value:!0});var e=require("number-helper-functions"),r=require("lodash"),t=function(e,r){this.type=e,this.count=r};exports.countArrayTypes=function(n){var u=n.reduce((function(r,t){var n=typeof t;return"string"===n&&e.isNumber(t)&&(n="number"),null==r[n]?r[n]=1:r[n]++,r}),{});return r.orderBy(Object.entries(u).map((function(e){return new t(e[0],e[1])})),"count","desc")}; //# sourceMappingURL=array-types-counter.cjs.production.min.js.map