@bloks/numbers
Advanced tools
Comparing version 25.0.28 to 25.0.57
@@ -47,2 +47,3 @@ import { BigNumber as BN } from 'bignumber.js'; | ||
toString(): string; | ||
toExtendedSymbol(): ExtendedSymbol; | ||
modifyAmount(x: number | BN.Instance | Asset | ExtendedAsset, method: Maths.Operations): ExtendedAsset; | ||
@@ -49,0 +50,0 @@ plus(x: number): ExtendedAsset; |
@@ -211,2 +211,6 @@ 'use strict'; | ||
_proto2.toExtendedSymbol = function toExtendedSymbol() { | ||
return new ExtendedSymbol(this.quantity.symbol, this.contract); | ||
}; | ||
_proto2.modifyAmount = function modifyAmount(x, method) { | ||
@@ -213,0 +217,0 @@ var amount = new bignumber_js.BigNumber(0); |
@@ -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 r=require("bignumber.js"),e=t(require("@jafri/numbro")),n=t(require("dayjs")),o=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,r){(null==r||r>t.length)&&(r=t.length);for(var e=0,n=new Array(r);e<r;e++)n[e]=t[e];return n}function m(t,r){var e;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(e=function(t,r){if(t){if("string"==typeof t)return a(t,void 0);var e=Object.prototype.toString.call(t).slice(8,-1);return"Object"===e&&t.constructor&&(e=t.constructor.name),"Map"===e||"Set"===e?Array.from(t):"Arguments"===e||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(e)?a(t,void 0):void 0}}(t))||r&&t&&"number"==typeof t.length){e&&(t=e);var n=0;return function(){return n>=t.length?{done:!0}:{done:!1,value:t[n++]}}}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(e=t[Symbol.iterator]()).next.bind(e)}var c,p,f=function(t,r){if(!t)throw new Error(r)};(c=(p=exports.Maths||(exports.Maths={})).Operations||(p.Operations={})).PLUS="plus",c.MULTIPLY="multipliedBy",c.DIVIDE="dividedBy",c.MINUS="minus";var d=function(){function t(t){this.symbol=new y({code:t.code,precision:t.precision}),this.amount=new r.BigNumber(t.amount)}t.fromString=function(e){var n=e.split(" "),o=n[0];return new t({code:n[1],precision:(o.split(".")[1]||[]).length,amount:new r.BigNumber(o)})},t.fromSymbol=function(r){var e=r.symbol,n=r.amount;if(!(e instanceof y))throw new Error("Invalid symbol");return new t({code:e.code,precision:e.precision,amount:n})};var e,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 r.BigNumber(this.amount).toFixed(this.symbol.precision,r.BigNumber.ROUND_DOWN)+" "+this.symbol.code},n.modifyAmount=function(e,n){var o=new r.BigNumber(0);return("number"==typeof e||r.BigNumber.isBigNumber(e))&&(o=new r.BigNumber(e)),e instanceof t&&(f(this.isLooselyEqualTo(e),"invalid symbol"),o=new r.BigNumber(e.amount)),t.fromSymbol({symbol:this.symbol,amount:this.amount[n](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)},(e=[{key:"integerAmount",get:function(){var t=Math.pow(10,this.symbol.precision);return this.amount.multipliedBy(t)}}])&&function(t,r){for(var e=0;e<r.length;e++){var n=r[e];n.enumerable=n.enumerable||!1,n.configurable=!0,"value"in n&&(n.writable=!0),Object.defineProperty(t,n.key,n)}}(t.prototype,e),t}(),l=function(){function t(t){if(!(t.quantity instanceof d))throw new Error("Invalid quantity");this.quantity=t.quantity,this.contract=t.contract}var e=t.prototype;return e.isEqualTo=function(t){return this.contract===t.contract&&this.quantity.isEqualTo(t.quantity)},e.isLooselyEqualTo=function(t){return this.contract===t.contract&&this.quantity.isLooselyEqualTo(t.quantity)},e.toString=function(){return this.quantity.toString()+"@"+this.contract},e.modifyAmount=function(e,n){var o=new r.BigNumber(0);return e instanceof t?(f(this.isLooselyEqualTo(e),"invalid contract or symbol"),o=e.quantity):o=e,new t({contract:this.contract,quantity:this.quantity.modifyAmount(o,n)})},e.plus=function(t){return this.modifyAmount(t,exports.Maths.Operations.PLUS)},e.minus=function(t){return this.modifyAmount(t,exports.Maths.Operations.MINUS)},e.multipliedBy=function(t){return this.modifyAmount(t,exports.Maths.Operations.MULTIPLY)},e.dividedBy=function(t){return this.modifyAmount(t,exports.Maths.Operations.DIVIDE)},t}(),y=function(){function t(t){this.precision=t.precision,this.code=t.code}t.fromString=function(r){var e=r.split(",");return new t({precision:+e[0],code:e[1]})};var r=t.prototype;return r.isEqualTo=function(t){return this.code===t.code&&this.precision===t.precision},r.toString=function(){return this.precision+","+this.code},t}(),b=function(){function t(t,r){this.sym=t,this.contract=r}var r=t.prototype;return r.isEqualTo=function(t){return this.sym.isEqualTo(t.sym)&&this.contract===t.contract},r.toString=function(){return this.sym.toString()+"@"+this.contract},t}(),h={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}},x={decimalSeparator:".",groupSeparator:",",groupSize:3};function v(t,e,n){return void 0===n&&(n=r.BigNumber.ROUND_DOWN),new r.BigNumber(t).toFixed(e,n)}function g(t,e,n){return void 0===n&&(n=r.BigNumber.ROUND_DOWN),new r.BigNumber(t).toFormat(e,n,x)}function M(t){var r=t.split(" "),e=r[0],n=r[1],o=(e.split(".")[1]||[]).length;return{amount:+e,symbol:{code:n,precision:o}}}function N(t,r){return void 0===r&&(r=!1),e(t).format({thousandSeparated:!0,trimMantissa:r})}function D(t,r,n){return void 0===n&&(n=!1),e(t).format({thousandSeparated:!0,mantissa:r,trimMantissa:n})}function S(t,r,n,o){return void 0===o&&(o=!1),e(t).format({thousandSeparated:!0,mantissa:n,trimMantissa:o})+" "+r}function A(t){return n(t)}function B(t){return n(t).utc()}function w(t,r){return void 0===r&&(r="MMM-DD-YYYY, hh:mm:ss A"),n(t).format(r)}function T(t){return new Date(t)}function Y(t){return t="Z"===t.slice(-1)?t:t+"Z",new Date(t)}function q(t,r){return void 0===r&&(r=3),n(t).clone().subtract(r,"days")}function E(t,r){return void 0===r&&(r=3),n(t).clone().add(r,"days")}r.BigNumber.set({ROUNDING_MODE:1}),n.extend(o),n.extend(i),n.extend(s),n.extend(u),exports.Asset=d,exports.ExtendedAsset=l,exports.ExtendedSymbol=b,exports.Symbol=y,exports.add=function(){for(var t=new r.BigNumber(0),e=arguments.length,n=new Array(e),o=0;o<e;o++)n[o]=arguments[o];if(n.length)for(var i,s=m(n);!(i=s()).done;){var u=i.value;t=t.plus(u)}return t},exports.bytesToKB=function(t){return void 0===t&&(t=0),e(t/1024).format({thousandSeparated:!1,mantissa:2})},exports.calculatePercentage=function(t,e,n){return v(new r.BigNumber(t).multipliedBy(e),n,r.BigNumber.ROUND_DOWN)},exports.currencyToSymbol=function(t){return h[t]},exports.dateToUtcTimePoint=function(t){return void 0===t&&(t=A()),n(t).utc().format("YYYY-MM-DDTHH:mm:ss.SSS")},exports.displayAsset=function(t){var r=M(t),e=r.symbol.code;return N(r.amount)+" "+e},exports.displayNumber=N,exports.displayNumberAsAmount=D,exports.displayNumberAsAsset=S,exports.displayNumberAsCurrency=function(t){var r=t.number,n=t.precision,o=t.average,i=void 0!==o&&o,s=t.lowPrecision,u=void 0===s||s,a=t.trimMantissa,m=void 0!==a&&a,c=t.currency,p=void 0===c?"USD":c;if(!h[p])throw new Error("Unsupported currency");var f=h[p],d=f.symbol,l={thousandSeparated:!0,mantissa:void 0!==n?n:f.precision,trimMantissa:m,average:i};return i&&(l.lowPrecision=u),""+d+e(r).format(l)},exports.displayRawNumberAsAsset=function(t,r,e,n){return void 0===n&&(n=!1),S(t/Math.pow(10,e),r,e,n)},exports.divide=function(t,e){return new r.BigNumber(t).dividedBy(e)},exports.emptyTimePoint="1970-01-01T00:00:00.000",exports.endDate=E,exports.eosDisplayFormatting=function(t,r,e){return g(t,e)+" "+r},exports.formatDate=w,exports.formatDateLocal=function(t,r){return void 0===r&&(r="MMM-DD-YYYY, hh:mm:ss A"),n(t).utc().format(r)},exports.formatEndDate=function(t){return E(t).format("MMM-DD-YYYY, hh:mm:ss A")},exports.formatStartDate=function(t){return q(t).format("MMM-DD-YYYY, hh:mm:ss A")},exports.inFuture=function(t,r){return void 0===r&&(r=!1),r?B(t).isAfter(B()):A(t).isAfter(A())},exports.inPast=function(t,r){return void 0===r&&(r=!1),r?B(t).isBefore(B()):A(t).isBefore(A())},exports.isSameDay=function(t,r){return void 0===r&&(r=A()),n(t).isSame(n(r),"day")},exports.millisecondsFrom=function(t,r){return void 0===r&&(r=A()),n(t).diff(n(r))},exports.multiply=function(t,e){return new r.BigNumber(t).multipliedBy(e)},exports.numberToAmount=v,exports.numberToAmountFormatted=g,exports.numberToAsset=function(t,r,n,o){return void 0===o&&(o=!1),e(t).format({thousandSeparated:!1,mantissa:n,trimMantissa:o})+" "+r},exports.numberToEos=function(t,r,e){return v(t,e)+" "+r},exports.numberToEosRoundUp=function(t,e,n){return v(t,n,r.BigNumber.ROUND_UP)+" "+e},exports.parseCpu=function(t){var r=0,e="";return t<1e3?(r=t,e="µs"):t<1e6?(r=t/1e3,e="ms"):t<6e7?(r=t/1e6,e="s"):t<36e8?(r=t/6e7,e="min"):t<36e11?(r=t/36e8,e="hours"):(r=t/864e8,e="days"),D(r,2,!0)+" "+e},exports.parseNetAndRam=function(t){var r=0,e="";return t<1024?(r=t,e="Bytes"):t<1048576?(r=t/1024,e="KB"):t<1073741824?(r=t/1048576,e="MB"):t<1099511627776?(r=t/1073741824,e="GB"):t<0x4000000000000&&(r=t/1099511627776,e="TB"),D(r,2,!0)+" "+e},exports.parseRex=function(t){return new r.BigNumber(t).dividedBy(1e4)},exports.parseSeconds=function(t){var r=0,e=0,n=0,o="";return t>86400&&(t-=86400*(r+=Math.floor(t/86400)),o+=r.toFixed(0)+" "+(1===r?"Day":"Days")+" "),t>3600&&(t-=3600*(e+=Math.floor(t/3600)),o+=e.toFixed(0)+" "+(1===e?"Hour":"Hours")+" "),t>60&&(t-=60*(n+=Math.floor(t/60)),o+=n.toFixed(0)+" "+(1===n?"Minute":"Minutes")+" "),t>0&&(o+=t.toFixed(0)+" Seconds "),o},exports.parseTimestamp=function(t,r){return void 0===r&&(r="MMM-DD-YYYY, hh:mm:ss A"),w(T(t),r)},exports.parseUtcTimestamp=function(t,r){return void 0===r&&(r="MMM-DD-YYYY, hh:mm:ss A"),w(Y(t),r)},exports.secondsFrom=function(t,r){return void 0===r&&(r=A()),n(t).diff(n(r),"second")},exports.split=M,exports.startDate=q,exports.substract=function(t,e){return new r.BigNumber(t).minus(e)},exports.time=A,exports.timestampFromNow=function(t){return A(t).fromNow()},exports.timestampToDate=T,exports.toBN=function(t){return new r.BigNumber(t)},exports.toNumbro=function(t){return e(t)},exports.unixTime=function(t){return n.unix(t)},exports.utcTime=B,exports.utcTimeToLocal=function(t){return n(t).local()},exports.utcTimestampFromNow=function(t){return A(t="Z"===t.slice(-1)?t:t+"Z").fromNow()},exports.utcTimestampToDate=Y; | ||
"use strict";function t(t){return t&&"object"==typeof t&&"default"in t?t.default:t}Object.defineProperty(exports,"__esModule",{value:!0});var r=require("bignumber.js"),n=t(require("@jafri/numbro")),e=t(require("dayjs")),o=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,r){(null==r||r>t.length)&&(r=t.length);for(var n=0,e=new Array(r);n<r;n++)e[n]=t[n];return e}function m(t,r){var n;if("undefined"==typeof Symbol||null==t[Symbol.iterator]){if(Array.isArray(t)||(n=function(t,r){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))||r&&t&&"number"==typeof t.length){n&&(t=n);var e=0;return function(){return e>=t.length?{done:!0}:{done:!1,value:t[e++]}}}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)}var c,p,f=function(t,r){if(!t)throw new Error(r)};(c=(p=exports.Maths||(exports.Maths={})).Operations||(p.Operations={})).PLUS="plus",c.MULTIPLY="multipliedBy",c.DIVIDE="dividedBy",c.MINUS="minus";var d=function(){function t(t){this.symbol=new y({code:t.code,precision:t.precision}),this.amount=new r.BigNumber(t.amount)}t.fromString=function(n){var e=n.split(" "),o=e[0];return new t({code:e[1],precision:(o.split(".")[1]||[]).length,amount:new r.BigNumber(o)})},t.fromSymbol=function(r){var n=r.symbol,e=r.amount;if(!(n instanceof y))throw new Error("Invalid symbol");return new t({code:n.code,precision:n.precision,amount:e})};var n,e=t.prototype;return e.isEqualTo=function(t){return this.isLooselyEqualTo(t)&&this.amount==t.amount},e.isLooselyEqualTo=function(t){return this.symbol.isEqualTo(t.symbol)},e.toString=function(){return new r.BigNumber(this.amount).toFixed(this.symbol.precision,r.BigNumber.ROUND_DOWN)+" "+this.symbol.code},e.modifyAmount=function(n,e){var o=new r.BigNumber(0);return("number"==typeof n||r.BigNumber.isBigNumber(n))&&(o=new r.BigNumber(n)),n instanceof t&&(f(this.isLooselyEqualTo(n),"invalid symbol"),o=new r.BigNumber(n.amount)),t.fromSymbol({symbol:this.symbol,amount:this.amount[e](o)})},e.plus=function(t){return this.modifyAmount(t,exports.Maths.Operations.PLUS)},e.minus=function(t){return this.modifyAmount(t,exports.Maths.Operations.MINUS)},e.multipliedBy=function(t){return this.modifyAmount(t,exports.Maths.Operations.MULTIPLY)},e.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,r){for(var n=0;n<r.length;n++){var e=r[n];e.enumerable=e.enumerable||!1,e.configurable=!0,"value"in e&&(e.writable=!0),Object.defineProperty(t,e.key,e)}}(t.prototype,n),t}(),l=function(){function t(t){if(!(t.quantity instanceof d))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.toExtendedSymbol=function(){return new b(this.quantity.symbol,this.contract)},n.modifyAmount=function(n,e){var o=new r.BigNumber(0);return n instanceof t?(f(this.isLooselyEqualTo(n),"invalid contract or symbol"),o=n.quantity):o=n,new t({contract:this.contract,quantity:this.quantity.modifyAmount(o,e)})},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}(),y=function(){function t(t){this.precision=t.precision,this.code=t.code}t.fromString=function(r){var n=r.split(",");return new t({precision:+n[0],code:n[1]})};var r=t.prototype;return r.isEqualTo=function(t){return this.code===t.code&&this.precision===t.precision},r.toString=function(){return this.precision+","+this.code},t}(),b=function(){function t(t,r){this.sym=t,this.contract=r}var r=t.prototype;return r.isEqualTo=function(t){return this.sym.isEqualTo(t.sym)&&this.contract===t.contract},r.toString=function(){return this.sym.toString()+"@"+this.contract},t}(),h={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}},x={decimalSeparator:".",groupSeparator:",",groupSize:3};function v(t,n,e){return void 0===e&&(e=r.BigNumber.ROUND_DOWN),new r.BigNumber(t).toFixed(n,e)}function g(t,n,e){return void 0===e&&(e=r.BigNumber.ROUND_DOWN),new r.BigNumber(t).toFormat(n,e,x)}function M(t){var r=t.split(" "),n=r[0],e=r[1],o=(n.split(".")[1]||[]).length;return{amount:+n,symbol:{code:e,precision:o}}}function N(t,r){return void 0===r&&(r=!1),n(t).format({thousandSeparated:!0,trimMantissa:r})}function D(t,r,e){return void 0===e&&(e=!1),n(t).format({thousandSeparated:!0,mantissa:r,trimMantissa:e})}function S(t,r,e,o){return void 0===o&&(o=!1),n(t).format({thousandSeparated:!0,mantissa:e,trimMantissa:o})+" "+r}function w(t){return e(t)}function A(t){return e(t).utc()}function B(t,r){return void 0===r&&(r="MMM-DD-YYYY, hh:mm:ss A"),e(t).format(r)}function T(t){return new Date(t)}function q(t){return t="Z"===t.slice(-1)?t:t+"Z",new Date(t)}function Y(t,r){return void 0===r&&(r=3),e(t).clone().subtract(r,"days")}function E(t,r){return void 0===r&&(r=3),e(t).clone().add(r,"days")}r.BigNumber.set({ROUNDING_MODE:1}),e.extend(o),e.extend(i),e.extend(s),e.extend(u),exports.Asset=d,exports.ExtendedAsset=l,exports.ExtendedSymbol=b,exports.Symbol=y,exports.add=function(){for(var t=new r.BigNumber(0),n=arguments.length,e=new Array(n),o=0;o<n;o++)e[o]=arguments[o];if(e.length)for(var i,s=m(e);!(i=s()).done;){var u=i.value;t=t.plus(u)}return t},exports.bytesToKB=function(t){return void 0===t&&(t=0),n(t/1024).format({thousandSeparated:!1,mantissa:2})},exports.calculatePercentage=function(t,n,e){return v(new r.BigNumber(t).multipliedBy(n),e,r.BigNumber.ROUND_DOWN)},exports.currencyToSymbol=function(t){return h[t]},exports.dateToUtcTimePoint=function(t){return void 0===t&&(t=w()),e(t).utc().format("YYYY-MM-DDTHH:mm:ss.SSS")},exports.displayAsset=function(t){var r=M(t),n=r.symbol.code;return N(r.amount)+" "+n},exports.displayNumber=N,exports.displayNumberAsAmount=D,exports.displayNumberAsAsset=S,exports.displayNumberAsCurrency=function(t){var r=t.number,e=t.precision,o=t.average,i=void 0!==o&&o,s=t.lowPrecision,u=void 0===s||s,a=t.trimMantissa,m=void 0!==a&&a,c=t.currency,p=void 0===c?"USD":c;if(!h[p])throw new Error("Unsupported currency");var f=h[p],d=f.symbol,l={thousandSeparated:!0,mantissa:void 0!==e?e:f.precision,trimMantissa:m,average:i};return i&&(l.lowPrecision=u),""+d+n(r).format(l)},exports.displayRawNumberAsAsset=function(t,r,n,e){return void 0===e&&(e=!1),S(t/Math.pow(10,n),r,n,e)},exports.divide=function(t,n){return new r.BigNumber(t).dividedBy(n)},exports.emptyTimePoint="1970-01-01T00:00:00.000",exports.endDate=E,exports.eosDisplayFormatting=function(t,r,n){return g(t,n)+" "+r},exports.formatDate=B,exports.formatDateLocal=function(t,r){return void 0===r&&(r="MMM-DD-YYYY, hh:mm:ss A"),e(t).utc().format(r)},exports.formatEndDate=function(t){return E(t).format("MMM-DD-YYYY, hh:mm:ss A")},exports.formatStartDate=function(t){return Y(t).format("MMM-DD-YYYY, hh:mm:ss A")},exports.inFuture=function(t,r){return void 0===r&&(r=!1),r?A(t).isAfter(A()):w(t).isAfter(w())},exports.inPast=function(t,r){return void 0===r&&(r=!1),r?A(t).isBefore(A()):w(t).isBefore(w())},exports.isSameDay=function(t,r){return void 0===r&&(r=w()),e(t).isSame(e(r),"day")},exports.millisecondsFrom=function(t,r){return void 0===r&&(r=w()),e(t).diff(e(r))},exports.multiply=function(t,n){return new r.BigNumber(t).multipliedBy(n)},exports.numberToAmount=v,exports.numberToAmountFormatted=g,exports.numberToAsset=function(t,r,e,o){return void 0===o&&(o=!1),n(t).format({thousandSeparated:!1,mantissa:e,trimMantissa:o})+" "+r},exports.numberToEos=function(t,r,n){return v(t,n)+" "+r},exports.numberToEosRoundUp=function(t,n,e){return v(t,e,r.BigNumber.ROUND_UP)+" "+n},exports.parseCpu=function(t){var r=0,n="";return t<1e3?(r=t,n="µs"):t<1e6?(r=t/1e3,n="ms"):t<6e7?(r=t/1e6,n="s"):t<36e8?(r=t/6e7,n="min"):t<36e11?(r=t/36e8,n="hours"):(r=t/864e8,n="days"),D(r,2,!0)+" "+n},exports.parseNetAndRam=function(t){var r=0,n="";return t<1024?(r=t,n="Bytes"):t<1048576?(r=t/1024,n="KB"):t<1073741824?(r=t/1048576,n="MB"):t<1099511627776?(r=t/1073741824,n="GB"):t<0x4000000000000&&(r=t/1099511627776,n="TB"),D(r,2,!0)+" "+n},exports.parseRex=function(t){return new r.BigNumber(t).dividedBy(1e4)},exports.parseSeconds=function(t){var r=0,n=0,e=0,o="";return t>86400&&(t-=86400*(r+=Math.floor(t/86400)),o+=r.toFixed(0)+" "+(1===r?"Day":"Days")+" "),t>3600&&(t-=3600*(n+=Math.floor(t/3600)),o+=n.toFixed(0)+" "+(1===n?"Hour":"Hours")+" "),t>60&&(t-=60*(e+=Math.floor(t/60)),o+=e.toFixed(0)+" "+(1===e?"Minute":"Minutes")+" "),t>0&&(o+=t.toFixed(0)+" Seconds "),o},exports.parseTimestamp=function(t,r){return void 0===r&&(r="MMM-DD-YYYY, hh:mm:ss A"),B(T(t),r)},exports.parseUtcTimestamp=function(t,r){return void 0===r&&(r="MMM-DD-YYYY, hh:mm:ss A"),B(q(t),r)},exports.secondsFrom=function(t,r){return void 0===r&&(r=w()),e(t).diff(e(r),"second")},exports.split=M,exports.startDate=Y,exports.substract=function(t,n){return new r.BigNumber(t).minus(n)},exports.time=w,exports.timestampFromNow=function(t){return w(t).fromNow()},exports.timestampToDate=T,exports.toBN=function(t){return new r.BigNumber(t)},exports.toNumbro=function(t){return n(t)},exports.unixTime=function(t){return e.unix(t)},exports.utcTime=A,exports.utcTimeToLocal=function(t){return e(t).local()},exports.utcTimestampFromNow=function(t){return w(t="Z"===t.slice(-1)?t:t+"Z").fromNow()},exports.utcTimestampToDate=q; | ||
//# sourceMappingURL=numbers.cjs.production.min.js.map |
@@ -207,2 +207,6 @@ import { BigNumber } from 'bignumber.js'; | ||
_proto2.toExtendedSymbol = function toExtendedSymbol() { | ||
return new ExtendedSymbol(this.quantity.symbol, this.contract); | ||
}; | ||
_proto2.modifyAmount = function modifyAmount(x, method) { | ||
@@ -209,0 +213,0 @@ var amount = new BigNumber(0); |
{ | ||
"name": "@bloks/numbers", | ||
"version": "25.0.28", | ||
"version": "25.0.57", | ||
"author": "jafri", | ||
@@ -23,3 +23,3 @@ "module": "dist/api.esm.js", | ||
}, | ||
"gitHead": "e1b2faff46fe5b40fc718ce308b3b1458215a03f" | ||
"gitHead": "68450ef6a34f78fd2b8664aef2545bcf189001c2" | ||
} |
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
165452
1694