@barchart/portfolio-api-common 1.0.258 → 1.0.259
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.
- package/lib/processing/PositionGroup.js +1 -1
- package/package.json +1 -1
- package/test/SpecRunner.js +16 -122
|
@@ -677,7 +677,7 @@ module.exports = (() => {
|
|
|
677
677
|
actual.cashTotal = updates.cashTotal;
|
|
678
678
|
|
|
679
679
|
format.basis = formatCurrency(actual.basis, currency);
|
|
680
|
-
format.realized = formatCurrency(actual.
|
|
680
|
+
format.realized = formatCurrency(actual.realized, currency);
|
|
681
681
|
format.unrealized = formatCurrency(actual.unrealized, currency);
|
|
682
682
|
format.income = formatCurrency(actual.income, currency);
|
|
683
683
|
format.summaryTotalCurrent = formatCurrency(updates.summaryTotalCurrent, currency);
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){function
|
|
1
|
+
(function(){function e(t,n,r){function s(o,u){if(!n[o]){if(!t[o]){var a=typeof require=="function"&&require;if(!u&&a)return a(o,!0);if(i)return i(o,!0);var f=new Error("Cannot find module '"+o+"'");throw f.code="MODULE_NOT_FOUND",f}var l=n[o]={exports:{}};t[o][0].call(l.exports,function(e){var n=t[o][1][e];return s(n?n:e)},l,l.exports,e,t,n,r)}return n[o].exports}var i=typeof require=="function"&&require;for(var o=0;o<r.length;o++)s(r[o]);return s}return e})()({1:[function(require,module,exports){
|
|
2
2
|
const uuid = require('uuid');
|
|
3
3
|
|
|
4
4
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
@@ -2434,7 +2434,7 @@ module.exports = (() => {
|
|
|
2434
2434
|
actual.cashTotal = updates.cashTotal;
|
|
2435
2435
|
|
|
2436
2436
|
format.basis = formatCurrency(actual.basis, currency);
|
|
2437
|
-
format.realized = formatCurrency(actual.
|
|
2437
|
+
format.realized = formatCurrency(actual.realized, currency);
|
|
2438
2438
|
format.unrealized = formatCurrency(actual.unrealized, currency);
|
|
2439
2439
|
format.income = formatCurrency(actual.income, currency);
|
|
2440
2440
|
format.summaryTotalCurrent = formatCurrency(updates.summaryTotalCurrent, currency);
|
|
@@ -3635,31 +3635,14 @@ module.exports = function () {
|
|
|
3635
3635
|
}
|
|
3636
3636
|
|
|
3637
3637
|
/**
|
|
3638
|
-
*
|
|
3638
|
+
* Returns the parent node. If this is the root node, a null value is returned.
|
|
3639
3639
|
*
|
|
3640
3640
|
* @public
|
|
3641
|
-
* @returns {Tree}
|
|
3641
|
+
* @returns {Tree|null}
|
|
3642
3642
|
*/
|
|
3643
3643
|
|
|
3644
3644
|
|
|
3645
3645
|
_createClass(Tree, [{
|
|
3646
|
-
key: 'getRoot',
|
|
3647
|
-
value: function getRoot() {
|
|
3648
|
-
if (this.getIsRoot()) {
|
|
3649
|
-
return this;
|
|
3650
|
-
} else {
|
|
3651
|
-
return this._parent.getRoot();
|
|
3652
|
-
}
|
|
3653
|
-
}
|
|
3654
|
-
|
|
3655
|
-
/**
|
|
3656
|
-
* Returns the parent node. If this is the root node, a null value is returned.
|
|
3657
|
-
*
|
|
3658
|
-
* @public
|
|
3659
|
-
* @returns {Tree|null}
|
|
3660
|
-
*/
|
|
3661
|
-
|
|
3662
|
-
}, {
|
|
3663
3646
|
key: 'getParent',
|
|
3664
3647
|
value: function getParent() {
|
|
3665
3648
|
return this._parent;
|
|
@@ -3760,23 +3743,6 @@ module.exports = function () {
|
|
|
3760
3743
|
}
|
|
3761
3744
|
}
|
|
3762
3745
|
|
|
3763
|
-
/**
|
|
3764
|
-
* Removes the current node from the parent tree. Use on a root node
|
|
3765
|
-
* has no effect.
|
|
3766
|
-
*
|
|
3767
|
-
* @public
|
|
3768
|
-
*/
|
|
3769
|
-
|
|
3770
|
-
}, {
|
|
3771
|
-
key: 'sever',
|
|
3772
|
-
value: function sever() {
|
|
3773
|
-
if (this.getIsRoot()) {
|
|
3774
|
-
return;
|
|
3775
|
-
}
|
|
3776
|
-
|
|
3777
|
-
this.getParent().removeChild(this);
|
|
3778
|
-
}
|
|
3779
|
-
|
|
3780
3746
|
/**
|
|
3781
3747
|
* Searches the children nodes for the first child node that matches the
|
|
3782
3748
|
* predicate.
|
|
@@ -3881,33 +3847,6 @@ module.exports = function () {
|
|
|
3881
3847
|
}
|
|
3882
3848
|
}
|
|
3883
3849
|
|
|
3884
|
-
/**
|
|
3885
|
-
* Climbs the tree, evaluating each parent until a predicate is matched. Once matched,
|
|
3886
|
-
* the {@link Tree} node is returned. Otherwise, if the predicate cannot be matched,
|
|
3887
|
-
* a null value is returned.
|
|
3888
|
-
*
|
|
3889
|
-
* @public
|
|
3890
|
-
* @param {Tree~nodePredicate} predicate - A predicate that tests each child node. The predicate takes two arguments -- the node's value, and the node itself.
|
|
3891
|
-
* @param {boolean=} includeCurrentNode - If true, the predicate will be applied to the current node.
|
|
3892
|
-
* @returns {Tree|null}
|
|
3893
|
-
*/
|
|
3894
|
-
|
|
3895
|
-
}, {
|
|
3896
|
-
key: 'findParent',
|
|
3897
|
-
value: function findParent(predicate, includeCurrentNode) {
|
|
3898
|
-
var returnRef = void 0;
|
|
3899
|
-
|
|
3900
|
-
if (is.boolean(includeCurrentNode) && includeCurrentNode && predicate(this.getValue(), this)) {
|
|
3901
|
-
returnRef = this;
|
|
3902
|
-
} else if (this._parent !== null) {
|
|
3903
|
-
returnRef = this._parent.findParent(predicate, true);
|
|
3904
|
-
} else {
|
|
3905
|
-
returnRef = null;
|
|
3906
|
-
}
|
|
3907
|
-
|
|
3908
|
-
return returnRef;
|
|
3909
|
-
}
|
|
3910
|
-
|
|
3911
3850
|
/**
|
|
3912
3851
|
* Creates a representation of the tree using JavaScript objects and arrays.
|
|
3913
3852
|
*
|
|
@@ -5198,20 +5137,6 @@ module.exports = function () {
|
|
|
5198
5137
|
return this._big.gt(getBig(other));
|
|
5199
5138
|
}
|
|
5200
5139
|
|
|
5201
|
-
/**
|
|
5202
|
-
* Returns true if the current instance is greater than or equal to the value.
|
|
5203
|
-
*
|
|
5204
|
-
* @public
|
|
5205
|
-
* @param {Decimal|Number|String} other - The value to compare.
|
|
5206
|
-
* @returns {Boolean}
|
|
5207
|
-
*/
|
|
5208
|
-
|
|
5209
|
-
}, {
|
|
5210
|
-
key: 'getIsGreaterThanOrEqual',
|
|
5211
|
-
value: function getIsGreaterThanOrEqual(other) {
|
|
5212
|
-
return this._big.gte(getBig(other));
|
|
5213
|
-
}
|
|
5214
|
-
|
|
5215
5140
|
/**
|
|
5216
5141
|
* Returns true if the current instance is less than the value.
|
|
5217
5142
|
*
|
|
@@ -5226,20 +5151,6 @@ module.exports = function () {
|
|
|
5226
5151
|
return this._big.lt(getBig(other));
|
|
5227
5152
|
}
|
|
5228
5153
|
|
|
5229
|
-
/**
|
|
5230
|
-
* Returns true if the current instance is less than or equal to the value.
|
|
5231
|
-
*
|
|
5232
|
-
* @public
|
|
5233
|
-
* @param {Decimal|Number|String} other - The value to compare.
|
|
5234
|
-
* @returns {Boolean}
|
|
5235
|
-
*/
|
|
5236
|
-
|
|
5237
|
-
}, {
|
|
5238
|
-
key: 'getIsLessThanOrEqual',
|
|
5239
|
-
value: function getIsLessThanOrEqual(other) {
|
|
5240
|
-
return this._big.lte(getBig(other));
|
|
5241
|
-
}
|
|
5242
|
-
|
|
5243
5154
|
/**
|
|
5244
5155
|
* Returns true if the current instance is equal to the value.
|
|
5245
5156
|
*
|
|
@@ -5439,9 +5350,9 @@ module.exports = function () {
|
|
|
5439
5350
|
assert.argumentIsRequired(a, 'a', Decimal, 'Decimal');
|
|
5440
5351
|
assert.argumentIsRequired(b, 'b', Decimal, 'Decimal');
|
|
5441
5352
|
|
|
5442
|
-
if (a._big.gt(b
|
|
5353
|
+
if (a._big.gt(b)) {
|
|
5443
5354
|
return 1;
|
|
5444
|
-
} else if (a._big.lt(b
|
|
5355
|
+
} else if (a._big.lt(b)) {
|
|
5445
5356
|
return -1;
|
|
5446
5357
|
} else {
|
|
5447
5358
|
return 0;
|
|
@@ -5902,10 +5813,12 @@ var _createClass = function () { function defineProperties(target, props) { for
|
|
|
5902
5813
|
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
5903
5814
|
|
|
5904
5815
|
var assert = require('./assert'),
|
|
5816
|
+
is = require('./is'),
|
|
5905
5817
|
memoize = require('./memoize');
|
|
5906
5818
|
|
|
5907
5819
|
var Currency = require('./Currency'),
|
|
5908
|
-
Decimal = require('./Decimal')
|
|
5820
|
+
Decimal = require('./Decimal'),
|
|
5821
|
+
Enum = require('./Enum');
|
|
5909
5822
|
|
|
5910
5823
|
module.exports = function () {
|
|
5911
5824
|
'use strict';
|
|
@@ -6085,7 +5998,12 @@ module.exports = function () {
|
|
|
6085
5998
|
assert.argumentIsRequired(amount, 'amount', Decimal, 'Decimal');
|
|
6086
5999
|
assert.argumentIsRequired(currency, 'currency', Currency, 'Currency');
|
|
6087
6000
|
assert.argumentIsRequired(desiredCurrency, 'desiredCurrency', Currency, 'Currency');
|
|
6088
|
-
|
|
6001
|
+
|
|
6002
|
+
for (var _len = arguments.length, rates = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
6003
|
+
rates[_key - 3] = arguments[_key];
|
|
6004
|
+
}
|
|
6005
|
+
|
|
6006
|
+
assert.argumentIsArray(rates, 'rates', Rate, 'Rate');
|
|
6089
6007
|
|
|
6090
6008
|
var converted = void 0;
|
|
6091
6009
|
|
|
@@ -6095,10 +6013,6 @@ module.exports = function () {
|
|
|
6095
6013
|
var numerator = desiredCurrency;
|
|
6096
6014
|
var denominator = currency;
|
|
6097
6015
|
|
|
6098
|
-
for (var _len = arguments.length, rates = Array(_len > 3 ? _len - 3 : 0), _key = 3; _key < _len; _key++) {
|
|
6099
|
-
rates[_key - 3] = arguments[_key];
|
|
6100
|
-
}
|
|
6101
|
-
|
|
6102
6016
|
var rate = rates.find(function (r) {
|
|
6103
6017
|
return r.numerator === numerator && r.denominator === denominator || r.numerator === denominator && r.denominator === numerator;
|
|
6104
6018
|
});
|
|
@@ -6149,7 +6063,7 @@ module.exports = function () {
|
|
|
6149
6063
|
return Rate;
|
|
6150
6064
|
}();
|
|
6151
6065
|
|
|
6152
|
-
},{"./Currency":15,"./Decimal":17,"./assert":22,"./memoize":25}],21:[function(require,module,exports){
|
|
6066
|
+
},{"./Currency":15,"./Decimal":17,"./Enum":19,"./assert":22,"./is":24,"./memoize":25}],21:[function(require,module,exports){
|
|
6153
6067
|
'use strict';
|
|
6154
6068
|
|
|
6155
6069
|
var assert = require('./assert'),
|
|
@@ -6526,26 +6440,6 @@ module.exports = function () {
|
|
|
6526
6440
|
});
|
|
6527
6441
|
|
|
6528
6442
|
return returnRef;
|
|
6529
|
-
},
|
|
6530
|
-
|
|
6531
|
-
|
|
6532
|
-
/**
|
|
6533
|
-
* Removes the first item from an array which matches a predicate.
|
|
6534
|
-
*
|
|
6535
|
-
* @static
|
|
6536
|
-
* @public
|
|
6537
|
-
* @param {Array} a
|
|
6538
|
-
* @param {Function} predicate
|
|
6539
|
-
*/
|
|
6540
|
-
remove: function remove(a, predicate) {
|
|
6541
|
-
assert.argumentIsArray(a, 'a');
|
|
6542
|
-
assert.argumentIsRequired(predicate, 'predicate', Function);
|
|
6543
|
-
|
|
6544
|
-
var index = a.findIndex(predicate);
|
|
6545
|
-
|
|
6546
|
-
if (!(index < 0)) {
|
|
6547
|
-
a.splice(index, 1);
|
|
6548
|
-
}
|
|
6549
6443
|
}
|
|
6550
6444
|
};
|
|
6551
6445
|
}();
|