@barchart/common-js
Advanced tools
Comparing version 3.0.3 to 3.0.4
@@ -7,3 +7,3 @@ module.exports = (() => { | ||
* an item, a reference to the parent node, and a reference to | ||
* children nodes. | ||
* children nodes. Children are stored in insertion order. | ||
* | ||
@@ -10,0 +10,0 @@ * @public |
@@ -215,2 +215,13 @@ const assert = require('./assert'), | ||
/** | ||
* Parses the value emitted by {@link Decimal#toJSON}. | ||
* | ||
* @public | ||
* @param {String} value | ||
* @returns {Decimal} | ||
*/ | ||
static parse(value) { | ||
return new Decimal(value); | ||
} | ||
/** | ||
* Returns an instance with the value of zero. | ||
@@ -217,0 +228,0 @@ * |
@@ -65,2 +65,6 @@ const assert = require('./assert'); | ||
toJSON() { | ||
return this.code; | ||
} | ||
/** | ||
@@ -67,0 +71,0 @@ * Looks up a enumeration item; given the enumeration type and the enumeration |
@@ -15,3 +15,3 @@ const assert = require('./assert'), | ||
* @param {Decimal|Number|String} - A amount, which can be parsed as a {@link Decimal} | ||
* @param {Currecny} - The currency. | ||
* @param {Currency} - The currency. | ||
*/ | ||
@@ -50,2 +50,25 @@ class Money { | ||
/** | ||
* Returns the JSON representation. | ||
* | ||
* @public | ||
* @returns {Object} | ||
*/ | ||
toJSON() { | ||
return { | ||
decimal: this._decimal, | ||
currency: this._currency | ||
}; | ||
} | ||
/** | ||
* Parses the value emitted by {@link Decimal#toJSON}. | ||
* | ||
* @public | ||
* @param {Object} value | ||
* @returns {Money} | ||
*/ | ||
static parse(value) { | ||
return new Money(value.decimal, value.currency); | ||
} | ||
toString() { | ||
@@ -52,0 +75,0 @@ return `[Money]`; |
@@ -65,2 +65,13 @@ const assert = require('./assert'), | ||
/** | ||
* Parses the value emitted by {@link Timestamp#toJSON}. | ||
* | ||
* @public | ||
* @param {String} value | ||
* @returns {Timestamp} | ||
*/ | ||
static parse(value) { | ||
return new Timestamp(value); | ||
} | ||
toString() { | ||
@@ -67,0 +78,0 @@ return '[Timestamp]'; |
{ | ||
"name": "@barchart/common-js", | ||
"version": "3.0.3", | ||
"version": "3.0.4", | ||
"description": "Library of common javascript utilities", | ||
@@ -5,0 +5,0 @@ "author": { |
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
Sorry, the diff of this file is too big to display
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
2439274
133
53016