@barchart/portfolio-api-common 1.2.73 → 1.2.74

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -102,6 +102,7 @@ module.exports = (() => {
102
102
  .withField('legacy.portfolio', DataType.STRING, true)
103
103
  .withField('legacy.position', DataType.STRING, true)
104
104
  .withField('system.version', DataType.NUMBER, true)
105
+ .withField('system.locked', DataType.BOOLEAN, true)
105
106
  .withField('root', DataType.STRING, true)
106
107
  .schema
107
108
  );
@@ -131,6 +132,7 @@ module.exports = (() => {
131
132
  .withField('snapshot.basis', DataType.DECIMAL)
132
133
  .withField('snapshot.income', DataType.DECIMAL)
133
134
  .withField('snapshot.value', DataType.DECIMAL)
135
+ .withField('system.locked', DataType.BOOLEAN, true)
134
136
  .withField('previous', DataType.NUMBER, true)
135
137
  .schema
136
138
  );
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.73",
3
+ "version": "1.2.74",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -6282,15 +6282,17 @@ module.exports = function () {
6282
6282
  *
6283
6283
  * @public
6284
6284
  * @param {Boolean=} approximate
6285
+ * @param {Number=} places
6285
6286
  * @returns {Boolean}
6286
6287
  */
6287
6288
 
6288
6289
  }, {
6289
6290
  key: 'getIsZero',
6290
- value: function getIsZero(approximate) {
6291
+ value: function getIsZero(approximate, places) {
6291
6292
  assert.argumentIsOptional(approximate, 'approximate', Boolean);
6293
+ assert.argumentIsOptional(places, 'places', Number);
6292
6294
 
6293
- return this._big.eq(zero) || is.boolean(approximate) && approximate && this.round(20, RoundingMode.NORMAL).getIsZero();
6295
+ return this._big.eq(zero) || is.boolean(approximate) && approximate && this.round(places || Big.DP, RoundingMode.NORMAL).getIsZero();
6294
6296
  }
6295
6297
 
6296
6298
  /**
@@ -6389,6 +6391,43 @@ module.exports = function () {
6389
6391
  return this._big.eq(getBig(other));
6390
6392
  }
6391
6393
 
6394
+ /**
6395
+ * Returns true if the current instance is an integer (i.e. has no decimal
6396
+ * component).
6397
+ *
6398
+ * @public
6399
+ * @return {Boolean}
6400
+ */
6401
+
6402
+ }, {
6403
+ key: 'getIsInteger',
6404
+ value: function getIsInteger() {
6405
+ return this.getIsEqual(this.round(0));
6406
+ }
6407
+
6408
+ /**
6409
+ * Returns the number of decimal places used.
6410
+ *
6411
+ * @public
6412
+ * @returns {Number}
6413
+ */
6414
+
6415
+ }, {
6416
+ key: 'getDecimalPlaces',
6417
+ value: function getDecimalPlaces() {
6418
+ var matches = this.toFixed().match(/-?\d*\.(\d*)/);
6419
+
6420
+ var returnVal = void 0;
6421
+
6422
+ if (matches === null) {
6423
+ returnVal = 0;
6424
+ } else {
6425
+ returnVal = matches[1].length;
6426
+ }
6427
+
6428
+ return returnVal;
6429
+ }
6430
+
6392
6431
  /**
6393
6432
  * Emits a floating point value that approximates the value of the current
6394
6433
  * instance.