Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

@bloks/numbers

Package Overview
Dependencies
Maintainers
1
Versions
34
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@bloks/numbers - npm Package Compare versions

Comparing version 23.0.0 to 23.0.1

3

dist/assets.d.ts
import { BN } from './bn';
declare enum MathOperations {
export declare enum MathOperations {
PLUS = "plus",

@@ -73,2 +73,1 @@ MULTIPLY = "multipliedBy",

}
export {};

@@ -111,4 +111,2 @@ 'use strict';

var MathOperations;
(function (MathOperations) {

@@ -119,3 +117,3 @@ MathOperations["PLUS"] = "plus";

MathOperations["MINUS"] = "minus";
})(MathOperations || (MathOperations = {}));
})(exports.MathOperations || (exports.MathOperations = {}));

@@ -147,2 +145,7 @@ var Asset = /*#__PURE__*/function () {

amount = _ref.amount;
if (!(symbol instanceof Symbol$1)) {
throw new Error('Invalid symbol');
}
return new Asset({

@@ -188,15 +191,15 @@ code: symbol.code,

_proto.plus = function plus(x) {
return this.modifyAmount(x, MathOperations.PLUS);
return this.modifyAmount(x, exports.MathOperations.PLUS);
};
_proto.minus = function minus(x) {
return this.modifyAmount(x, MathOperations.MINUS);
return this.modifyAmount(x, exports.MathOperations.MINUS);
};
_proto.multipliedBy = function multipliedBy(x) {
return this.modifyAmount(x, MathOperations.MULTIPLY);
return this.modifyAmount(x, exports.MathOperations.MULTIPLY);
};
_proto.dividedBy = function dividedBy(x) {
return this.modifyAmount(x, MathOperations.DIVIDE);
return this.modifyAmount(x, exports.MathOperations.DIVIDE);
};

@@ -216,2 +219,6 @@

function ExtendedAsset(extendedAsset) {
if (!(extendedAsset.quantity instanceof Asset)) {
throw new Error('Invalid quantity');
}
this.quantity = extendedAsset.quantity;

@@ -252,15 +259,15 @@ this.contract = extendedAsset.contract;

_proto2.plus = function plus(x) {
return this.modifyAmount(x, MathOperations.PLUS);
return this.modifyAmount(x, exports.MathOperations.PLUS);
};
_proto2.minus = function minus(x) {
return this.modifyAmount(x, MathOperations.MINUS);
return this.modifyAmount(x, exports.MathOperations.MINUS);
};
_proto2.multipliedBy = function multipliedBy(x) {
return this.modifyAmount(x, MathOperations.MULTIPLY);
return this.modifyAmount(x, exports.MathOperations.MULTIPLY);
};
_proto2.dividedBy = function dividedBy(x) {
return this.modifyAmount(x, MathOperations.DIVIDE);
return this.modifyAmount(x, exports.MathOperations.DIVIDE);
};

@@ -267,0 +274,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 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=n.BigNumber,f=function(t,n){if(!t)throw new Error(n)};!function(t){t.PLUS="plus",t.MULTIPLY="multipliedBy",t.DIVIDE="dividedBy",t.MINUS="minus"}(m||(m={}));var d=function(){function t(t){this.symbol=new y({code:t.code,precision:t.precision}),this.amount=new p(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 p(r)})},t.fromSymbol=function(n){var o=n.symbol;return new t({code:o.code,precision:o.precision,amount:n.amount})};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 p(this.amount).toFixed(this.symbol.precision,p.ROUND_DOWN)+" "+this.symbol.code},o.modifyAmount=function(n,o){var r=new p(0);return("number"==typeof n||p.isBigNumber(n))&&(r=new p(n)),n instanceof t&&(f(this.isLooselyEqualTo(n),"invalid symbol"),r=new p(n.amount)),t.fromSymbol({symbol:this.symbol,amount:this.amount[o](r)})},o.plus=function(t){return this.modifyAmount(t,m.PLUS)},o.minus=function(t){return this.modifyAmount(t,m.MINUS)},o.multipliedBy=function(t){return this.modifyAmount(t,m.MULTIPLY)},o.dividedBy=function(t){return this.modifyAmount(t,m.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}(),l=function(){function t(t){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 p(0);return n instanceof t?(f(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,m.PLUS)},n.minus=function(t){return this.modifyAmount(t,m.MINUS)},n.multipliedBy=function(t){return this.modifyAmount(t,m.MULTIPLY)},n.dividedBy=function(t){return this.modifyAmount(t,m.DIVIDE)},t}(),y=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}(),h=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}(),b={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,o){return void 0===o&&(o=p.ROUND_DOWN),new p(t).toFixed(n,o)}function D(t,n,o){return void 0===o&&(o=p.ROUND_DOWN),new p(t).toFormat(n,o,x)}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 T(t,n,r){return void 0===r&&(r=!1),o(t).format({thousandSeparated:!0,mantissa:n,trimMantissa:r})}function M(t,n,r,e){return void 0===e&&(e=!1),o(t).format({thousandSeparated:!0,mantissa:r,trimMantissa:e})+" "+n}function w(t){return r(t)}function g(t){return r(t).utc()}function N(t,n){return void 0===n&&(n="MMM-DD-YYYY, hh:mm:ss A"),r(t).format(n)}function Y(t){return new Date(t)}function q(t){return t="Z"===t.slice(-1)?t:t+"Z",new Date(t)}function E(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=d,exports.BN=p,exports.ExtendedAsset=l,exports.ExtendedSymbol=h,exports.Symbol=y,exports.add=function(){for(var t=new p(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 v(new p(t).multipliedBy(n),o,p.ROUND_DOWN)},exports.currencyToSymbol=function(t){return b[t]},exports.dateToUtcTimePoint=function(t){return void 0===t&&(t=w()),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=T,exports.displayNumberAsAsset=M,exports.displayNumberAsCurrency=function(t,n,r){void 0===n&&(n="USD");var e=b[n],i=e.precision;return""+e.symbol+o(t).format({thousandSeparated:!0,mantissa:void 0!==r?r:i})},exports.displayRawNumberAsAsset=function(t,n,o,r){return void 0===r&&(r=!1),M(t/Math.pow(10,o),n,o,r)},exports.divide=function(t,n){return new p(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=N,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 E(t).format("MMM-DD-YYYY, hh:mm:ss A")},exports.inFuture=function(t,n){return void 0===n&&(n=!1),n?g(t).isAfter(g()):w(t).isAfter(w())},exports.inPast=function(t,n){return void 0===n&&(n=!1),n?g(t).isBefore(g()):w(t).isBefore(w())},exports.isSameDay=function(t,n){return void 0===n&&(n=w()),r(t).isSame(r(n),"day")},exports.millisecondsFrom=function(t,n){return void 0===n&&(n=w()),r(t).diff(r(n))},exports.multiply=function(t,n){return new p(t).multipliedBy(n)},exports.numberToAmount=v,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 v(t,o)+" "+n},exports.numberToEosRoundUp=function(t,n,o){return v(t,o,p.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"),T(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"),T(n,2,!0)+" "+o},exports.parseRex=function(t){return new p(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"),N(Y(t),n)},exports.parseUtcTimestamp=function(t,n){return void 0===n&&(n="MMM-DD-YYYY, hh:mm:ss A"),N(q(t),n)},exports.secondsFrom=function(t,n){return void 0===n&&(n=w()),r(t).diff(r(n),"second")},exports.split=S,exports.startDate=E,exports.substract=function(t,n){return new p(t).minus(n)},exports.time=w,exports.timestampFromNow=function(t){return w(t).fromNow()},exports.timestampToDate=Y,exports.toBN=function(t){return new p(t)},exports.toNumbro=function(t){return o(t)},exports.unixTime=function(t){return r.unix(t)},exports.utcTime=g,exports.utcTimeToLocal=function(t){return r(t).local()},exports.utcTimestampFromNow=function(t){return w(t="Z"===t.slice(-1)?t:t+"Z").fromNow()},exports.utcTimestampToDate=q;
"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=n.BigNumber,f=function(t,n){if(!t)throw new Error(n)};(m=exports.MathOperations||(exports.MathOperations={})).PLUS="plus",m.MULTIPLY="multipliedBy",m.DIVIDE="dividedBy",m.MINUS="minus";var d=function(){function t(t){this.symbol=new y({code:t.code,precision:t.precision}),this.amount=new p(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 p(r)})},t.fromSymbol=function(n){var o=n.symbol,r=n.amount;if(!(o instanceof y))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 p(this.amount).toFixed(this.symbol.precision,p.ROUND_DOWN)+" "+this.symbol.code},o.modifyAmount=function(n,o){var r=new p(0);return("number"==typeof n||p.isBigNumber(n))&&(r=new p(n)),n instanceof t&&(f(this.isLooselyEqualTo(n),"invalid symbol"),r=new p(n.amount)),t.fromSymbol({symbol:this.symbol,amount:this.amount[o](r)})},o.plus=function(t){return this.modifyAmount(t,exports.MathOperations.PLUS)},o.minus=function(t){return this.modifyAmount(t,exports.MathOperations.MINUS)},o.multipliedBy=function(t){return this.modifyAmount(t,exports.MathOperations.MULTIPLY)},o.dividedBy=function(t){return this.modifyAmount(t,exports.MathOperations.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}(),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.modifyAmount=function(n,o){var r=new p(0);return n instanceof t?(f(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.MathOperations.PLUS)},n.minus=function(t){return this.modifyAmount(t,exports.MathOperations.MINUS)},n.multipliedBy=function(t){return this.modifyAmount(t,exports.MathOperations.MULTIPLY)},n.dividedBy=function(t){return this.modifyAmount(t,exports.MathOperations.DIVIDE)},t}(),y=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}(),h=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}(),x={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 v(t,n,o){return void 0===o&&(o=p.ROUND_DOWN),new p(t).toFixed(n,o)}function D(t,n,o){return void 0===o&&(o=p.ROUND_DOWN),new p(t).toFormat(n,o,b)}function M(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 S(t,n){return void 0===n&&(n=!1),o(t).format({thousandSeparated:!0,trimMantissa:n})}function A(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 w(t){return r(t)}function g(t){return r(t).utc()}function N(t,n){return void 0===n&&(n="MMM-DD-YYYY, hh:mm:ss A"),r(t).format(n)}function Y(t){return new Date(t)}function q(t){return t="Z"===t.slice(-1)?t:t+"Z",new Date(t)}function E(t,n){return void 0===n&&(n=3),r(t).clone().subtract(n,"days")}function O(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=d,exports.BN=p,exports.ExtendedAsset=l,exports.ExtendedSymbol=h,exports.Symbol=y,exports.add=function(){for(var t=new p(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 v(new p(t).multipliedBy(n),o,p.ROUND_DOWN)},exports.currencyToSymbol=function(t){return x[t]},exports.dateToUtcTimePoint=function(t){return void 0===t&&(t=w()),r(t).utc().format("YYYY-MM-DDTHH:mm:ss.SSS")},exports.displayAsset=function(t){var n=M(t),o=n.symbol.code;return S(n.amount)+" "+o},exports.displayNumber=S,exports.displayNumberAsAmount=A,exports.displayNumberAsAsset=T,exports.displayNumberAsCurrency=function(t,n,r){void 0===n&&(n="USD");var e=x[n],i=e.precision;return""+e.symbol+o(t).format({thousandSeparated:!0,mantissa:void 0!==r?r:i})},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 p(t).dividedBy(n)},exports.emptyTimePoint="1970-01-01T00:00:00.000",exports.endDate=O,exports.eosDisplayFormatting=function(t,n,o){return D(t,o)+" "+n},exports.formatDate=N,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 O(t).format("MMM-DD-YYYY, hh:mm:ss A")},exports.formatStartDate=function(t){return E(t).format("MMM-DD-YYYY, hh:mm:ss A")},exports.inFuture=function(t,n){return void 0===n&&(n=!1),n?g(t).isAfter(g()):w(t).isAfter(w())},exports.inPast=function(t,n){return void 0===n&&(n=!1),n?g(t).isBefore(g()):w(t).isBefore(w())},exports.isSameDay=function(t,n){return void 0===n&&(n=w()),r(t).isSame(r(n),"day")},exports.millisecondsFrom=function(t,n){return void 0===n&&(n=w()),r(t).diff(r(n))},exports.multiply=function(t,n){return new p(t).multipliedBy(n)},exports.numberToAmount=v,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 v(t,o)+" "+n},exports.numberToEosRoundUp=function(t,n,o){return v(t,o,p.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"),A(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"),A(n,2,!0)+" "+o},exports.parseRex=function(t){return new p(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"),N(Y(t),n)},exports.parseUtcTimestamp=function(t,n){return void 0===n&&(n="MMM-DD-YYYY, hh:mm:ss A"),N(q(t),n)},exports.secondsFrom=function(t,n){return void 0===n&&(n=w()),r(t).diff(r(n),"second")},exports.split=M,exports.startDate=E,exports.substract=function(t,n){return new p(t).minus(n)},exports.time=w,exports.timestampFromNow=function(t){return w(t).fromNow()},exports.timestampToDate=Y,exports.toBN=function(t){return new p(t)},exports.toNumbro=function(t){return o(t)},exports.unixTime=function(t){return r.unix(t)},exports.utcTime=g,exports.utcTimeToLocal=function(t){return r(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

@@ -139,2 +139,7 @@ import { BigNumber } from 'bignumber.js';

amount = _ref.amount;
if (!(symbol instanceof Symbol$1)) {
throw new Error('Invalid symbol');
}
return new Asset({

@@ -207,2 +212,6 @@ code: symbol.code,

function ExtendedAsset(extendedAsset) {
if (!(extendedAsset.quantity instanceof Asset)) {
throw new Error('Invalid quantity');
}
this.quantity = extendedAsset.quantity;

@@ -776,3 +785,3 @@ this.contract = extendedAsset.contract;

export { Asset, BN, ExtendedAsset, ExtendedSymbol, Symbol$1 as Symbol, add, bytesToKB, calculatePercentage, currencyToSymbol, dateToUtcTimePoint, displayAsset, displayNumber, displayNumberAsAmount, displayNumberAsAsset, displayNumberAsCurrency, displayRawNumberAsAsset, divide, emptyTimePoint, endDate, eosDisplayFormatting, formatDate, formatDateLocal, formatEndDate, formatStartDate, inFuture, inPast, isSameDay, millisecondsFrom, multiply, numberToAmount, numberToAmountFormatted, numberToAsset, numberToEos, numberToEosRoundUp, parseCpu, parseNetAndRam, parseRex, parseSeconds, parseTimestamp, parseUtcTimestamp, secondsFrom, split, startDate, substract, time, timestampFromNow, timestampToDate, toBN, toNumbro, unixTime, utcTime, utcTimeToLocal, utcTimestampFromNow, utcTimestampToDate };
export { Asset, BN, ExtendedAsset, ExtendedSymbol, MathOperations, Symbol$1 as Symbol, add, bytesToKB, calculatePercentage, currencyToSymbol, dateToUtcTimePoint, displayAsset, displayNumber, displayNumberAsAmount, displayNumberAsAsset, displayNumberAsCurrency, displayRawNumberAsAsset, divide, emptyTimePoint, endDate, eosDisplayFormatting, formatDate, formatDateLocal, formatEndDate, formatStartDate, inFuture, inPast, isSameDay, millisecondsFrom, multiply, numberToAmount, numberToAmountFormatted, numberToAsset, numberToEos, numberToEosRoundUp, parseCpu, parseNetAndRam, parseRex, parseSeconds, parseTimestamp, parseUtcTimestamp, secondsFrom, split, startDate, substract, time, timestampFromNow, timestampToDate, toBN, toNumbro, unixTime, utcTime, utcTimeToLocal, utcTimestampFromNow, utcTimestampToDate };
//# sourceMappingURL=numbers.esm.js.map
{
"name": "@bloks/numbers",
"version": "23.0.0",
"version": "23.0.1",
"author": "jafri",

@@ -26,3 +26,3 @@ "module": "dist/api.esm.js",

},
"gitHead": "930969bd16b4900ce03f3420df4e6cff6aed58ae"
"gitHead": "46b2acf53c695909bb8d2ac50a0dab7ea853d3bb"
}

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc