UNPKG

@techmely/utils

Version:

Collection of helpful JavaScript / TypeScript utils

24 lines (18 loc) 526 B
'use strict'; /*! * @techmely/utils * Copyright(c) 2021-2024 Techmely <techmely.creation@gmail.com> * MIT Licensed */ // src/isNumber.ts function isNumber(val) { return toString.call(val) === "[object Number]"; } // src/formatLot10Volume.ts function formatLot10Volume(volume, precision = 0, defaultValue = "-") { if (!isNumber(volume)) { return defaultValue; } return (volume * 10)?.toLocaleString("en", { minimumFractionDigits: precision }).slice(0, -1); } exports.formatLot10Volume = formatLot10Volume;