@bloks/numbers
Advanced tools
Comparing version 25.0.6 to 25.0.7
@@ -499,2 +499,4 @@ 'use strict'; | ||
average = _ref$average === void 0 ? false : _ref$average, | ||
_ref$lowPrecision = _ref.lowPrecision, | ||
lowPrecision = _ref$lowPrecision === void 0 ? true : _ref$lowPrecision, | ||
_ref$trimMantissa = _ref.trimMantissa, | ||
@@ -517,3 +519,3 @@ trimMantissa = _ref$trimMantissa === void 0 ? false : _ref$trimMantissa, | ||
average: average, | ||
lowPrecision: false | ||
lowPrecision: lowPrecision | ||
}); | ||
@@ -520,0 +522,0 @@ return "" + symbol + formattedNumber; |
@@ -1,2 +0,2 @@ | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var n=require("bignumber.js"),o=t(require("@jafri/numbro")),r=t(require("dayjs")),e=t(require("dayjs/plugin/relativeTime")),i=t(require("dayjs/plugin/utc")),s=t(require("dayjs/plugin/timezone")),u=t(require("dayjs/plugin/advancedFormat"));function a(t,n){(null==n||n>t.length)&&(n=t.length);for(var o=0,r=new Array(n);o<n;o++)r[o]=t[o];return r}function c(t,n){var o;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(o=function(t,n){if(t){if("string"==typeof t)return a(t,void 0);var o=Object.prototype.toString.call(t).slice(8,-1);return"Object"===o&&t.constructor&&(o=t.constructor.name),"Map"===o||"Set"===o?Array.from(t):"Arguments"===o||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(o)?a(t,void 0):void 0}}(t))||n&&t&&"number"==typeof t.length){o&&(t=o);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(o=t[Symbol.iterator]()).next.bind(o)}n.BigNumber.set({ROUNDING_MODE:1});var m,p,f=n.BigNumber,d=function(t,n){if(!t)throw new Error(n)};(m=(p=exports.Maths||(exports.Maths={})).Operations||(p.Operations={})).PLUS="plus",m.MULTIPLY="multipliedBy",m.DIVIDE="dividedBy",m.MINUS="minus";var l=function(){function t(t){this.symbol=new h({code:t.code,precision:t.precision}),this.amount=new f(t.amount)}t.fromString=function(n){var o=n.split(" "),r=o[0];return new t({code:o[1],precision:(r.split(".")[1]||[]).length,amount:new f(r)})},t.fromSymbol=function(n){var o=n.symbol,r=n.amount;if(!(o instanceof h))throw new Error("Invalid symbol");return new t({code:o.code,precision:o.precision,amount:r})};var n,o=t.prototype;return o.isEqualTo=function(t){return this.isLooselyEqualTo(t)&&this.amount==t.amount},o.isLooselyEqualTo=function(t){return this.symbol.isEqualTo(t.symbol)},o.toString=function(){return new f(this.amount).toFixed(this.symbol.precision,f.ROUND_DOWN)+" "+this.symbol.code},o.modifyAmount=function(n,o){var r=new f(0);return("number"==typeof n||f.isBigNumber(n))&&(r=new f(n)),n instanceof t&&(d(this.isLooselyEqualTo(n),"invalid symbol"),r=new f(n.amount)),t.fromSymbol({symbol:this.symbol,amount:this.amount[o](r)})},o.plus=function(t){return this.modifyAmount(t,exports.Maths.Operations.PLUS)},o.minus=function(t){return this.modifyAmount(t,exports.Maths.Operations.MINUS)},o.multipliedBy=function(t){return this.modifyAmount(t,exports.Maths.Operations.MULTIPLY)},o.dividedBy=function(t){return this.modifyAmount(t,exports.Maths.Operations.DIVIDE)},(n=[{key:"integerAmount",get:function(){var t=Math.pow(10,this.symbol.precision);return this.amount.multipliedBy(t)}}])&&function(t,n){for(var o=0;o<n.length;o++){var r=n[o];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(t.prototype,n),t}(),y=function(){function t(t){if(!(t.quantity instanceof l))throw new Error("Invalid quantity");this.quantity=t.quantity,this.contract=t.contract}var n=t.prototype;return n.isEqualTo=function(t){return this.contract===t.contract&&this.quantity.isEqualTo(t.quantity)},n.isLooselyEqualTo=function(t){return this.contract===t.contract&&this.quantity.isLooselyEqualTo(t.quantity)},n.toString=function(){return this.quantity.toString()+"@"+this.contract},n.modifyAmount=function(n,o){var r=new f(0);return n instanceof t?(d(this.isLooselyEqualTo(n),"invalid contract or symbol"),r=n.quantity):r=n,new t({contract:this.contract,quantity:this.quantity.modifyAmount(r,o)})},n.plus=function(t){return this.modifyAmount(t,exports.Maths.Operations.PLUS)},n.minus=function(t){return this.modifyAmount(t,exports.Maths.Operations.MINUS)},n.multipliedBy=function(t){return this.modifyAmount(t,exports.Maths.Operations.MULTIPLY)},n.dividedBy=function(t){return this.modifyAmount(t,exports.Maths.Operations.DIVIDE)},t}(),h=function(){function t(t){this.precision=t.precision,this.code=t.code}t.fromString=function(n){var o=n.split(",");return new t({precision:+o[0],code:o[1]})};var n=t.prototype;return n.isEqualTo=function(t){return this.code===t.code&&this.precision===t.precision},n.toString=function(){return this.precision+","+this.code},t}(),x=function(){function t(t,n){this.sym=t,this.contract=n}var n=t.prototype;return n.isEqualTo=function(t){return this.sym.isEqualTo(t.sym)&&this.contract===t.contract},n.toString=function(){return this.sym.toString()+"@"+this.contract},t}(),v={GBP:{symbol:"£",precision:2},EUR:{symbol:"€",precision:2},JPY:{symbol:"¥",precision:0},CAD:{symbol:"CA$",precision:2},USD:{symbol:"$",precision:2},INR:{symbol:"₹",precision:2},CNY:{symbol:"CN¥",precision:2},HKD:{symbol:"HK$",precision:2},KRW:{symbol:"₩",precision:0},AUD:{symbol:"AUD$",precision:2},SAR:{symbol:"SR",precision:2},ETH:{symbol:"Ξ",precision:4},BTC:{symbol:"₿",precision:8},EOS:{symbol:"EOS",precision:4}},b={decimalSeparator:".",groupSeparator:",",groupSize:3};function M(t,n,o){return void 0===o&&(o=f.ROUND_DOWN),new f(t).toFixed(n,o)}function D(t,n,o){return void 0===o&&(o=f.ROUND_DOWN),new f(t).toFormat(n,o,b)}function S(t){var n=t.split(" "),o=n[0],r=n[1],e=(o.split(".")[1]||[]).length;return{amount:+o,symbol:{code:r,precision:e}}}function A(t,n){return void 0===n&&(n=!1),o(t).format({thousandSeparated:!0,trimMantissa:n})}function w(t,n,r){return void 0===r&&(r=!1),o(t).format({thousandSeparated:!0,mantissa:n,trimMantissa:r})}function T(t,n,r,e){return void 0===e&&(e=!1),o(t).format({thousandSeparated:!0,mantissa:r,trimMantissa:e})+" "+n}function g(t){return r(t)}function N(t){return r(t).utc()}function Y(t,n){return void 0===n&&(n="MMM-DD-YYYY, hh:mm:ss A"),r(t).format(n)}function q(t){return new Date(t)}function E(t){return t="Z"===t.slice(-1)?t:t+"Z",new Date(t)}function O(t,n){return void 0===n&&(n=3),r(t).clone().subtract(n,"days")}function B(t,n){return void 0===n&&(n=3),r(t).clone().add(n,"days")}r.extend(e),r.extend(i),r.extend(s),r.extend(u),exports.Asset=l,exports.BN=f,exports.ExtendedAsset=y,exports.ExtendedSymbol=x,exports.Symbol=h,exports.add=function(){for(var t=new f(0),n=arguments.length,o=new Array(n),r=0;r<n;r++)o[r]=arguments[r];if(o.length)for(var e,i=c(o);!(e=i()).done;){var s=e.value;t=t.plus(s)}return t},exports.bytesToKB=function(t){return void 0===t&&(t=0),o(t/1024).format({thousandSeparated:!1,mantissa:2})},exports.calculatePercentage=function(t,n,o){return M(new f(t).multipliedBy(n),o,f.ROUND_DOWN)},exports.currencyToSymbol=function(t){return v[t]},exports.dateToUtcTimePoint=function(t){return void 0===t&&(t=g()),r(t).utc().format("YYYY-MM-DDTHH:mm:ss.SSS")},exports.displayAsset=function(t){var n=S(t),o=n.symbol.code;return A(n.amount)+" "+o},exports.displayNumber=A,exports.displayNumberAsAmount=w,exports.displayNumberAsAsset=T,exports.displayNumberAsCurrency=function(t){var n=t.number,r=t.precision,e=t.average,i=void 0!==e&&e,s=t.trimMantissa,u=void 0!==s&&s,a=t.currency,c=void 0===a?"USD":a;if(!v[c])throw new Error("Unsupported currency");var m=v[c],p=m.precision;return""+m.symbol+o(n).format({thousandSeparated:!0,mantissa:void 0!==r?r:p,trimMantissa:u,average:i,lowPrecision:!1})},exports.displayRawNumberAsAsset=function(t,n,o,r){return void 0===r&&(r=!1),T(t/Math.pow(10,o),n,o,r)},exports.divide=function(t,n){return new f(t).dividedBy(n)},exports.emptyTimePoint="1970-01-01T00:00:00.000",exports.endDate=B,exports.eosDisplayFormatting=function(t,n,o){return D(t,o)+" "+n},exports.formatDate=Y,exports.formatDateLocal=function(t,n){return void 0===n&&(n="MMM-DD-YYYY, hh:mm:ss A"),r(t).utc().format(n)},exports.formatEndDate=function(t){return B(t).format("MMM-DD-YYYY, hh:mm:ss A")},exports.formatStartDate=function(t){return O(t).format("MMM-DD-YYYY, hh:mm:ss A")},exports.inFuture=function(t,n){return void 0===n&&(n=!1),n?N(t).isAfter(N()):g(t).isAfter(g())},exports.inPast=function(t,n){return void 0===n&&(n=!1),n?N(t).isBefore(N()):g(t).isBefore(g())},exports.isSameDay=function(t,n){return void 0===n&&(n=g()),r(t).isSame(r(n),"day")},exports.millisecondsFrom=function(t,n){return void 0===n&&(n=g()),r(t).diff(r(n))},exports.multiply=function(t,n){return new f(t).multipliedBy(n)},exports.numberToAmount=M,exports.numberToAmountFormatted=D,exports.numberToAsset=function(t,n,r,e){return void 0===e&&(e=!1),o(t).format({thousandSeparated:!1,mantissa:r,trimMantissa:e})+" "+n},exports.numberToEos=function(t,n,o){return M(t,o)+" "+n},exports.numberToEosRoundUp=function(t,n,o){return M(t,o,f.ROUND_UP)+" "+n},exports.parseCpu=function(t){var n=0,o="";return t<1e3?(n=t,o="µs"):t<1e6?(n=t/1e3,o="ms"):t<6e7?(n=t/1e6,o="s"):t<36e8?(n=t/6e7,o="min"):t<36e11?(n=t/36e8,o="hours"):(n=t/864e8,o="days"),w(n,2,!0)+" "+o},exports.parseNetAndRam=function(t){var n=0,o="";return t<1024?(n=t,o="Bytes"):t<1048576?(n=t/1024,o="KB"):t<1073741824?(n=t/1048576,o="MB"):t<1099511627776?(n=t/1073741824,o="GB"):t<0x4000000000000&&(n=t/1099511627776,o="TB"),w(n,2,!0)+" "+o},exports.parseRex=function(t){return new f(t).dividedBy(1e4)},exports.parseSeconds=function(t){var n=0,o=0,r=0,e="";return t>86400&&(t-=86400*(n+=Math.floor(t/86400)),e+=n.toFixed(0)+" "+(1===n?"Day":"Days")+" "),t>3600&&(t-=3600*(o+=Math.floor(t/3600)),e+=o.toFixed(0)+" "+(1===o?"Hour":"Hours")+" "),t>60&&(t-=60*(r+=Math.floor(t/60)),e+=r.toFixed(0)+" "+(1===r?"Minute":"Minutes")+" "),t>0&&(e+=t.toFixed(0)+" Seconds "),e},exports.parseTimestamp=function(t,n){return void 0===n&&(n="MMM-DD-YYYY, hh:mm:ss A"),Y(q(t),n)},exports.parseUtcTimestamp=function(t,n){return void 0===n&&(n="MMM-DD-YYYY, hh:mm:ss A"),Y(E(t),n)},exports.secondsFrom=function(t,n){return void 0===n&&(n=g()),r(t).diff(r(n),"second")},exports.split=S,exports.startDate=O,exports.substract=function(t,n){return new f(t).minus(n)},exports.time=g,exports.timestampFromNow=function(t){return g(t).fromNow()},exports.timestampToDate=q,exports.toBN=function(t){return new f(t)},exports.toNumbro=function(t){return o(t)},exports.unixTime=function(t){return r.unix(t)},exports.utcTime=N,exports.utcTimeToLocal=function(t){return r(t).local()},exports.utcTimestampFromNow=function(t){return g(t="Z"===t.slice(-1)?t:t+"Z").fromNow()},exports.utcTimestampToDate=E; | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var o=require("bignumber.js"),n=t(require("@jafri/numbro")),r=t(require("dayjs")),e=t(require("dayjs/plugin/relativeTime")),i=t(require("dayjs/plugin/utc")),s=t(require("dayjs/plugin/timezone")),u=t(require("dayjs/plugin/advancedFormat"));function a(t,o){(null==o||o>t.length)&&(o=t.length);for(var n=0,r=new Array(o);n<o;n++)r[n]=t[n];return r}function c(t,o){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,o){if(t){if("string"==typeof t)return a(t,void 0);var n=Object.prototype.toString.call(t).slice(8,-1);return"Object"===n&&t.constructor&&(n=t.constructor.name),"Map"===n||"Set"===n?Array.from(t):"Arguments"===n||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n)?a(t,void 0):void 0}}(t))||o&&t&&"number"==typeof t.length){n&&(t=n);var r=0;return function(){return r>=t.length?{done:!0}:{done:!1,value:t[r++]}}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}return(n=t[Symbol.iterator]()).next.bind(n)}o.BigNumber.set({ROUNDING_MODE:1});var m,p,f=o.BigNumber,d=function(t,o){if(!t)throw new Error(o)};(m=(p=exports.Maths||(exports.Maths={})).Operations||(p.Operations={})).PLUS="plus",m.MULTIPLY="multipliedBy",m.DIVIDE="dividedBy",m.MINUS="minus";var l=function(){function t(t){this.symbol=new h({code:t.code,precision:t.precision}),this.amount=new f(t.amount)}t.fromString=function(o){var n=o.split(" "),r=n[0];return new t({code:n[1],precision:(r.split(".")[1]||[]).length,amount:new f(r)})},t.fromSymbol=function(o){var n=o.symbol,r=o.amount;if(!(n instanceof h))throw new Error("Invalid symbol");return new t({code:n.code,precision:n.precision,amount:r})};var o,n=t.prototype;return n.isEqualTo=function(t){return this.isLooselyEqualTo(t)&&this.amount==t.amount},n.isLooselyEqualTo=function(t){return this.symbol.isEqualTo(t.symbol)},n.toString=function(){return new f(this.amount).toFixed(this.symbol.precision,f.ROUND_DOWN)+" "+this.symbol.code},n.modifyAmount=function(o,n){var r=new f(0);return("number"==typeof o||f.isBigNumber(o))&&(r=new f(o)),o instanceof t&&(d(this.isLooselyEqualTo(o),"invalid symbol"),r=new f(o.amount)),t.fromSymbol({symbol:this.symbol,amount:this.amount[n](r)})},n.plus=function(t){return this.modifyAmount(t,exports.Maths.Operations.PLUS)},n.minus=function(t){return this.modifyAmount(t,exports.Maths.Operations.MINUS)},n.multipliedBy=function(t){return this.modifyAmount(t,exports.Maths.Operations.MULTIPLY)},n.dividedBy=function(t){return this.modifyAmount(t,exports.Maths.Operations.DIVIDE)},(o=[{key:"integerAmount",get:function(){var t=Math.pow(10,this.symbol.precision);return this.amount.multipliedBy(t)}}])&&function(t,o){for(var n=0;n<o.length;n++){var r=o[n];r.enumerable=r.enumerable||!1,r.configurable=!0,"value"in r&&(r.writable=!0),Object.defineProperty(t,r.key,r)}}(t.prototype,o),t}(),y=function(){function t(t){if(!(t.quantity instanceof l))throw new Error("Invalid quantity");this.quantity=t.quantity,this.contract=t.contract}var o=t.prototype;return o.isEqualTo=function(t){return this.contract===t.contract&&this.quantity.isEqualTo(t.quantity)},o.isLooselyEqualTo=function(t){return this.contract===t.contract&&this.quantity.isLooselyEqualTo(t.quantity)},o.toString=function(){return this.quantity.toString()+"@"+this.contract},o.modifyAmount=function(o,n){var r=new f(0);return o instanceof t?(d(this.isLooselyEqualTo(o),"invalid contract or symbol"),r=o.quantity):r=o,new t({contract:this.contract,quantity:this.quantity.modifyAmount(r,n)})},o.plus=function(t){return this.modifyAmount(t,exports.Maths.Operations.PLUS)},o.minus=function(t){return this.modifyAmount(t,exports.Maths.Operations.MINUS)},o.multipliedBy=function(t){return this.modifyAmount(t,exports.Maths.Operations.MULTIPLY)},o.dividedBy=function(t){return this.modifyAmount(t,exports.Maths.Operations.DIVIDE)},t}(),h=function(){function t(t){this.precision=t.precision,this.code=t.code}t.fromString=function(o){var n=o.split(",");return new t({precision:+n[0],code:n[1]})};var o=t.prototype;return o.isEqualTo=function(t){return this.code===t.code&&this.precision===t.precision},o.toString=function(){return this.precision+","+this.code},t}(),x=function(){function t(t,o){this.sym=t,this.contract=o}var o=t.prototype;return o.isEqualTo=function(t){return this.sym.isEqualTo(t.sym)&&this.contract===t.contract},o.toString=function(){return this.sym.toString()+"@"+this.contract},t}(),v={GBP:{symbol:"£",precision:2},EUR:{symbol:"€",precision:2},JPY:{symbol:"¥",precision:0},CAD:{symbol:"CA$",precision:2},USD:{symbol:"$",precision:2},INR:{symbol:"₹",precision:2},CNY:{symbol:"CN¥",precision:2},HKD:{symbol:"HK$",precision:2},KRW:{symbol:"₩",precision:0},AUD:{symbol:"AUD$",precision:2},SAR:{symbol:"SR",precision:2},ETH:{symbol:"Ξ",precision:4},BTC:{symbol:"₿",precision:8},EOS:{symbol:"EOS",precision:4}},b={decimalSeparator:".",groupSeparator:",",groupSize:3};function M(t,o,n){return void 0===n&&(n=f.ROUND_DOWN),new f(t).toFixed(o,n)}function D(t,o,n){return void 0===n&&(n=f.ROUND_DOWN),new f(t).toFormat(o,n,b)}function S(t){var o=t.split(" "),n=o[0],r=o[1],e=(n.split(".")[1]||[]).length;return{amount:+n,symbol:{code:r,precision:e}}}function A(t,o){return void 0===o&&(o=!1),n(t).format({thousandSeparated:!0,trimMantissa:o})}function w(t,o,r){return void 0===r&&(r=!1),n(t).format({thousandSeparated:!0,mantissa:o,trimMantissa:r})}function T(t,o,r,e){return void 0===e&&(e=!1),n(t).format({thousandSeparated:!0,mantissa:r,trimMantissa:e})+" "+o}function g(t){return r(t)}function N(t){return r(t).utc()}function Y(t,o){return void 0===o&&(o="MMM-DD-YYYY, hh:mm:ss A"),r(t).format(o)}function q(t){return new Date(t)}function E(t){return t="Z"===t.slice(-1)?t:t+"Z",new Date(t)}function O(t,o){return void 0===o&&(o=3),r(t).clone().subtract(o,"days")}function B(t,o){return void 0===o&&(o=3),r(t).clone().add(o,"days")}r.extend(e),r.extend(i),r.extend(s),r.extend(u),exports.Asset=l,exports.BN=f,exports.ExtendedAsset=y,exports.ExtendedSymbol=x,exports.Symbol=h,exports.add=function(){for(var t=new f(0),o=arguments.length,n=new Array(o),r=0;r<o;r++)n[r]=arguments[r];if(n.length)for(var e,i=c(n);!(e=i()).done;){var s=e.value;t=t.plus(s)}return t},exports.bytesToKB=function(t){return void 0===t&&(t=0),n(t/1024).format({thousandSeparated:!1,mantissa:2})},exports.calculatePercentage=function(t,o,n){return M(new f(t).multipliedBy(o),n,f.ROUND_DOWN)},exports.currencyToSymbol=function(t){return v[t]},exports.dateToUtcTimePoint=function(t){return void 0===t&&(t=g()),r(t).utc().format("YYYY-MM-DDTHH:mm:ss.SSS")},exports.displayAsset=function(t){var o=S(t),n=o.symbol.code;return A(o.amount)+" "+n},exports.displayNumber=A,exports.displayNumberAsAmount=w,exports.displayNumberAsAsset=T,exports.displayNumberAsCurrency=function(t){var o=t.number,r=t.precision,e=t.average,i=void 0!==e&&e,s=t.lowPrecision,u=void 0===s||s,a=t.trimMantissa,c=void 0!==a&&a,m=t.currency,p=void 0===m?"USD":m;if(!v[p])throw new Error("Unsupported currency");var f=v[p],d=f.precision;return""+f.symbol+n(o).format({thousandSeparated:!0,mantissa:void 0!==r?r:d,trimMantissa:c,average:i,lowPrecision:u})},exports.displayRawNumberAsAsset=function(t,o,n,r){return void 0===r&&(r=!1),T(t/Math.pow(10,n),o,n,r)},exports.divide=function(t,o){return new f(t).dividedBy(o)},exports.emptyTimePoint="1970-01-01T00:00:00.000",exports.endDate=B,exports.eosDisplayFormatting=function(t,o,n){return D(t,n)+" "+o},exports.formatDate=Y,exports.formatDateLocal=function(t,o){return void 0===o&&(o="MMM-DD-YYYY, hh:mm:ss A"),r(t).utc().format(o)},exports.formatEndDate=function(t){return B(t).format("MMM-DD-YYYY, hh:mm:ss A")},exports.formatStartDate=function(t){return O(t).format("MMM-DD-YYYY, hh:mm:ss A")},exports.inFuture=function(t,o){return void 0===o&&(o=!1),o?N(t).isAfter(N()):g(t).isAfter(g())},exports.inPast=function(t,o){return void 0===o&&(o=!1),o?N(t).isBefore(N()):g(t).isBefore(g())},exports.isSameDay=function(t,o){return void 0===o&&(o=g()),r(t).isSame(r(o),"day")},exports.millisecondsFrom=function(t,o){return void 0===o&&(o=g()),r(t).diff(r(o))},exports.multiply=function(t,o){return new f(t).multipliedBy(o)},exports.numberToAmount=M,exports.numberToAmountFormatted=D,exports.numberToAsset=function(t,o,r,e){return void 0===e&&(e=!1),n(t).format({thousandSeparated:!1,mantissa:r,trimMantissa:e})+" "+o},exports.numberToEos=function(t,o,n){return M(t,n)+" "+o},exports.numberToEosRoundUp=function(t,o,n){return M(t,n,f.ROUND_UP)+" "+o},exports.parseCpu=function(t){var o=0,n="";return t<1e3?(o=t,n="µs"):t<1e6?(o=t/1e3,n="ms"):t<6e7?(o=t/1e6,n="s"):t<36e8?(o=t/6e7,n="min"):t<36e11?(o=t/36e8,n="hours"):(o=t/864e8,n="days"),w(o,2,!0)+" "+n},exports.parseNetAndRam=function(t){var o=0,n="";return t<1024?(o=t,n="Bytes"):t<1048576?(o=t/1024,n="KB"):t<1073741824?(o=t/1048576,n="MB"):t<1099511627776?(o=t/1073741824,n="GB"):t<0x4000000000000&&(o=t/1099511627776,n="TB"),w(o,2,!0)+" "+n},exports.parseRex=function(t){return new f(t).dividedBy(1e4)},exports.parseSeconds=function(t){var o=0,n=0,r=0,e="";return t>86400&&(t-=86400*(o+=Math.floor(t/86400)),e+=o.toFixed(0)+" "+(1===o?"Day":"Days")+" "),t>3600&&(t-=3600*(n+=Math.floor(t/3600)),e+=n.toFixed(0)+" "+(1===n?"Hour":"Hours")+" "),t>60&&(t-=60*(r+=Math.floor(t/60)),e+=r.toFixed(0)+" "+(1===r?"Minute":"Minutes")+" "),t>0&&(e+=t.toFixed(0)+" Seconds "),e},exports.parseTimestamp=function(t,o){return void 0===o&&(o="MMM-DD-YYYY, hh:mm:ss A"),Y(q(t),o)},exports.parseUtcTimestamp=function(t,o){return void 0===o&&(o="MMM-DD-YYYY, hh:mm:ss A"),Y(E(t),o)},exports.secondsFrom=function(t,o){return void 0===o&&(o=g()),r(t).diff(r(o),"second")},exports.split=S,exports.startDate=O,exports.substract=function(t,o){return new f(t).minus(o)},exports.time=g,exports.timestampFromNow=function(t){return g(t).fromNow()},exports.timestampToDate=q,exports.toBN=function(t){return new f(t)},exports.toNumbro=function(t){return n(t)},exports.unixTime=function(t){return r.unix(t)},exports.utcTime=N,exports.utcTimeToLocal=function(t){return r(t).local()},exports.utcTimestampFromNow=function(t){return g(t="Z"===t.slice(-1)?t:t+"Z").fromNow()},exports.utcTimestampToDate=E; | ||
//# sourceMappingURL=numbers.cjs.production.min.js.map |
@@ -48,5 +48,6 @@ import numbro from '@jafri/numbro'; | ||
*/ | ||
export declare function displayNumberAsCurrency({ number, precision, average, trimMantissa, currency, }: { | ||
export declare function displayNumberAsCurrency({ number, precision, average, lowPrecision, trimMantissa, currency, }: { | ||
number: number; | ||
average?: boolean; | ||
lowPrecision?: boolean; | ||
trimMantissa?: boolean; | ||
@@ -53,0 +54,0 @@ precision?: number; |
@@ -495,2 +495,4 @@ import { BigNumber } from 'bignumber.js'; | ||
average = _ref$average === void 0 ? false : _ref$average, | ||
_ref$lowPrecision = _ref.lowPrecision, | ||
lowPrecision = _ref$lowPrecision === void 0 ? true : _ref$lowPrecision, | ||
_ref$trimMantissa = _ref.trimMantissa, | ||
@@ -513,3 +515,3 @@ trimMantissa = _ref$trimMantissa === void 0 ? false : _ref$trimMantissa, | ||
average: average, | ||
lowPrecision: false | ||
lowPrecision: lowPrecision | ||
}); | ||
@@ -516,0 +518,0 @@ return "" + symbol + formattedNumber; |
{ | ||
"name": "@bloks/numbers", | ||
"version": "25.0.6", | ||
"version": "25.0.7", | ||
"author": "jafri", | ||
@@ -23,3 +23,3 @@ "module": "dist/api.esm.js", | ||
}, | ||
"gitHead": "71cd999f64f29c9ded34ef7cec1f644763820d72" | ||
"gitHead": "0ac3d4a76292e4e55fef2e4ddba5eeee244b7540" | ||
} |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
163154
1685