UNPKG

uno-js

Version:

JS/TS common used functions, zero dependencies

14 lines (13 loc) 703 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.getQuartile = exports.humanize = void 0; const humanize = (name) => (name || '').replace(/^./, (str) => str.toUpperCase()).replace(/([a-z])([A-Z])/g, '$1 $2'); exports.humanize = humanize; const getQuartile = (data) => { const sortedData = data.filter((x) => x !== 0).sort((a, b) => a - b); const firstQuartile = sortedData[Math.floor(sortedData.length / 4)]; const secondQuartile = sortedData[Math.floor(sortedData.length / 2)]; const thirdQuartile = sortedData[Math.floor((sortedData.length * 3) / 4)]; return [firstQuartile, secondQuartile, thirdQuartile]; }; exports.getQuartile = getQuartile;