@glif/filecoin-number
Advanced tools
Comparing version 2.0.60 to 2.0.62
@@ -16,2 +16,3 @@ /// <reference types="node" /> | ||
export declare class FilecoinNumber extends BigNumber { | ||
static readonly DefaultUnit: string; | ||
private static zeroMap; | ||
@@ -18,0 +19,0 @@ private readonly _coinType; |
@@ -92,3 +92,3 @@ "use strict"; | ||
var coinType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : CoinType.MAIN; | ||
var unit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'FIL'; | ||
var unit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : FilecoinNumber.DefaultUnit; | ||
(0, _classCallCheck2["default"])(this, FilecoinNumber); | ||
@@ -336,3 +336,3 @@ _this = _super.call(this, toBigNumberValue(value, denom)); | ||
get: function get() { | ||
var addT = this._coinType === CoinType.TEST && this._unit === 'FIL'; | ||
var addT = this._coinType === CoinType.TEST && this._unit === FilecoinNumber.DefaultUnit; | ||
return "".concat(addT ? 't' : '').concat(this._unit); | ||
@@ -353,3 +353,3 @@ } | ||
var coinType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : CoinType.MAIN; | ||
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'FIL'; | ||
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FilecoinNumber.DefaultUnit; | ||
if (this.zeroMap[coinType][unit] === undefined) this.zeroMap[coinType][unit] = new FilecoinNumber(0, 'fil', coinType, unit); | ||
@@ -363,3 +363,4 @@ return this.zeroMap[coinType][unit]; | ||
exports.FilecoinNumber = FilecoinNumber; | ||
(0, _defineProperty3["default"])(FilecoinNumber, "DefaultUnit", 'FIL'); | ||
(0, _defineProperty3["default"])(FilecoinNumber, "zeroMap", (_defineProperty2 = {}, (0, _defineProperty3["default"])(_defineProperty2, CoinType.MAIN, {}), (0, _defineProperty3["default"])(_defineProperty2, CoinType.TEST, {}), _defineProperty2)); | ||
//# sourceMappingURL=FilecoinNumber.js.map |
@@ -71,3 +71,3 @@ import _classCallCheck from "@babel/runtime/helpers/classCallCheck"; | ||
var coinType = arguments.length > 2 && arguments[2] !== undefined ? arguments[2] : CoinType.MAIN; | ||
var unit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : 'FIL'; | ||
var unit = arguments.length > 3 && arguments[3] !== undefined ? arguments[3] : FilecoinNumber.DefaultUnit; | ||
@@ -320,3 +320,3 @@ _classCallCheck(this, FilecoinNumber); | ||
get: function get() { | ||
var addT = this._coinType === CoinType.TEST && this._unit === 'FIL'; | ||
var addT = this._coinType === CoinType.TEST && this._unit === FilecoinNumber.DefaultUnit; | ||
return "".concat(addT ? 't' : '').concat(this._unit); | ||
@@ -337,3 +337,3 @@ } | ||
var coinType = arguments.length > 0 && arguments[0] !== undefined ? arguments[0] : CoinType.MAIN; | ||
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : 'FIL'; | ||
var unit = arguments.length > 1 && arguments[1] !== undefined ? arguments[1] : FilecoinNumber.DefaultUnit; | ||
if (this.zeroMap[coinType][unit] === undefined) this.zeroMap[coinType][unit] = new FilecoinNumber(0, 'fil', coinType, unit); | ||
@@ -347,3 +347,5 @@ return this.zeroMap[coinType][unit]; | ||
_defineProperty(FilecoinNumber, "DefaultUnit", 'FIL'); | ||
_defineProperty(FilecoinNumber, "zeroMap", (_defineProperty2 = {}, _defineProperty(_defineProperty2, CoinType.MAIN, {}), _defineProperty(_defineProperty2, CoinType.TEST, {}), _defineProperty2)); | ||
//# sourceMappingURL=FilecoinNumber.js.map |
@@ -50,3 +50,3 @@ import _defineProperty from "@babel/runtime/helpers/defineProperty"; | ||
// Constructor params | ||
constructor(value, denom, coinType = CoinType.MAIN, unit = 'FIL') { | ||
constructor(value, denom, coinType = CoinType.MAIN, unit = FilecoinNumber.DefaultUnit) { | ||
super(toBigNumberValue(value, denom)); | ||
@@ -75,3 +75,3 @@ | ||
static zero(coinType = CoinType.MAIN, unit = 'FIL') { | ||
static zero(coinType = CoinType.MAIN, unit = FilecoinNumber.DefaultUnit) { | ||
if (this.zeroMap[coinType][unit] === undefined) this.zeroMap[coinType][unit] = new FilecoinNumber(0, 'fil', coinType, unit); | ||
@@ -86,3 +86,3 @@ return this.zeroMap[coinType][unit]; | ||
get unit() { | ||
const addT = this._coinType === CoinType.TEST && this._unit === 'FIL'; | ||
const addT = this._coinType === CoinType.TEST && this._unit === FilecoinNumber.DefaultUnit; | ||
return `${addT ? 't' : ''}${this._unit}`; | ||
@@ -293,2 +293,4 @@ } | ||
_defineProperty(FilecoinNumber, "DefaultUnit", 'FIL'); | ||
_defineProperty(FilecoinNumber, "zeroMap", { | ||
@@ -295,0 +297,0 @@ [CoinType.MAIN]: {}, |
{ | ||
"name": "@glif/filecoin-number", | ||
"version": "2.0.60", | ||
"version": "2.0.62", | ||
"description": "a javascript package to handle Filecoin numbers like Fil and AttoFil", | ||
@@ -50,3 +50,3 @@ "main": "./dist/index.js", | ||
}, | ||
"gitHead": "3dabfa8393494034d527a43e81afac55bd37e288" | ||
"gitHead": "7747cb9057a40d1590869142e25a2270699f1c39" | ||
} |
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
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
151450
1362