@barchart/portfolio-api-common 1.2.56 → 1.2.57
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/data/TransactionValidator.js +2 -1
- package/package.json +1 -1
- package/test/SpecRunner.js +35 -25
|
@@ -82,8 +82,9 @@ module.exports = (() => {
|
|
|
82
82
|
static getInvalidIndex(transactions) {
|
|
83
83
|
assert.argumentIsArray(transactions, 'transactions');
|
|
84
84
|
|
|
85
|
-
return transactions.findIndex((t, i
|
|
85
|
+
return transactions.findIndex((t, i) => t.sequence !== (i + 1) || (i !== 0 && t.date.getIsBefore(transactions[i - 1].date)))
|
|
86
86
|
|
|
87
|
+
//return transactions.findIndex((t, i, a) => t.sequence !== (i + 1) || (i !== 0 && t.date.getIsBefore(a[ i - 1 ].date)));
|
|
87
88
|
//return transactions.findIndex((t, i, a) => t.sequence !== (i + 1) || (i !== 0 && t.date.getIsBefore(a[ i - 1 ].date)) || (i !== 0 && t.date.getIsEqual(a[i - 1].date) && t.type.sequence < a[i - 1].type.sequence));
|
|
88
89
|
}
|
|
89
90
|
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1139,8 +1139,9 @@ module.exports = (() => {
|
|
|
1139
1139
|
static getInvalidIndex(transactions) {
|
|
1140
1140
|
assert.argumentIsArray(transactions, 'transactions');
|
|
1141
1141
|
|
|
1142
|
-
return transactions.findIndex((t, i
|
|
1142
|
+
return transactions.findIndex((t, i) => t.sequence !== (i + 1) || (i !== 0 && t.date.getIsBefore(transactions[i - 1].date)))
|
|
1143
1143
|
|
|
1144
|
+
//return transactions.findIndex((t, i, a) => t.sequence !== (i + 1) || (i !== 0 && t.date.getIsBefore(a[ i - 1 ].date)));
|
|
1144
1145
|
//return transactions.findIndex((t, i, a) => t.sequence !== (i + 1) || (i !== 0 && t.date.getIsBefore(a[ i - 1 ].date)) || (i !== 0 && t.date.getIsEqual(a[i - 1].date) && t.type.sequence < a[i - 1].type.sequence));
|
|
1145
1146
|
}
|
|
1146
1147
|
|
|
@@ -5165,8 +5166,8 @@ module.exports = function () {
|
|
|
5165
5166
|
* Compares two strings (in ascending order), using {@link String#localeCompare}.
|
|
5166
5167
|
*
|
|
5167
5168
|
* @static
|
|
5168
|
-
* @param {
|
|
5169
|
-
* @param {
|
|
5169
|
+
* @param {String} a
|
|
5170
|
+
* @param {String} b
|
|
5170
5171
|
* @returns {Number}
|
|
5171
5172
|
*/
|
|
5172
5173
|
compareStrings: function compareStrings(a, b) {
|
|
@@ -5856,7 +5857,7 @@ module.exports = function () {
|
|
|
5856
5857
|
* @returns {String}
|
|
5857
5858
|
*/
|
|
5858
5859
|
value: function format() {
|
|
5859
|
-
return this._year + '-' + leftPad(this._month) + '-' + leftPad(this._day);
|
|
5860
|
+
return leftPad(this._year, 4, '0') + '-' + leftPad(this._month, 2, '0') + '-' + leftPad(this._day, 2, '0');
|
|
5860
5861
|
}
|
|
5861
5862
|
|
|
5862
5863
|
/**
|
|
@@ -5973,7 +5974,7 @@ module.exports = function () {
|
|
|
5973
5974
|
*
|
|
5974
5975
|
* @static
|
|
5975
5976
|
* @public
|
|
5976
|
-
* @
|
|
5977
|
+
* @returns {Day}
|
|
5977
5978
|
*/
|
|
5978
5979
|
|
|
5979
5980
|
}, {
|
|
@@ -6065,8 +6066,11 @@ module.exports = function () {
|
|
|
6065
6066
|
|
|
6066
6067
|
var dayRegex = /^([0-9]{4}).?([0-9]{2}).?([0-9]{2})$/;
|
|
6067
6068
|
|
|
6068
|
-
function leftPad(value) {
|
|
6069
|
-
|
|
6069
|
+
function leftPad(value, digits, character) {
|
|
6070
|
+
var string = value.toString();
|
|
6071
|
+
var padding = digits - string.length;
|
|
6072
|
+
|
|
6073
|
+
return '' + character.repeat(padding) + string;
|
|
6070
6074
|
}
|
|
6071
6075
|
|
|
6072
6076
|
var comparator = ComparatorBuilder.startWith(function (a, b) {
|
|
@@ -6421,7 +6425,7 @@ module.exports = function () {
|
|
|
6421
6425
|
*
|
|
6422
6426
|
* @public
|
|
6423
6427
|
* @param {Decimal} instance
|
|
6424
|
-
* @
|
|
6428
|
+
* @returns {Boolean}
|
|
6425
6429
|
*/
|
|
6426
6430
|
value: function getIsZero(instance) {
|
|
6427
6431
|
assert.argumentIsRequired(instance, 'instance', Decimal, 'Decimal');
|
|
@@ -6434,7 +6438,7 @@ module.exports = function () {
|
|
|
6434
6438
|
*
|
|
6435
6439
|
* @public
|
|
6436
6440
|
* @param {Decimal} instance
|
|
6437
|
-
* @
|
|
6441
|
+
* @returns {Boolean}
|
|
6438
6442
|
*/
|
|
6439
6443
|
|
|
6440
6444
|
}, {
|
|
@@ -6450,7 +6454,7 @@ module.exports = function () {
|
|
|
6450
6454
|
*
|
|
6451
6455
|
* @public
|
|
6452
6456
|
* @param {Decimal} instance
|
|
6453
|
-
* @
|
|
6457
|
+
* @returns {Boolean}
|
|
6454
6458
|
*/
|
|
6455
6459
|
|
|
6456
6460
|
}, {
|
|
@@ -6466,7 +6470,7 @@ module.exports = function () {
|
|
|
6466
6470
|
*
|
|
6467
6471
|
* @public
|
|
6468
6472
|
* @param {Decimal} instance
|
|
6469
|
-
* @
|
|
6473
|
+
* @returns {Boolean}
|
|
6470
6474
|
*/
|
|
6471
6475
|
|
|
6472
6476
|
}, {
|
|
@@ -6482,7 +6486,7 @@ module.exports = function () {
|
|
|
6482
6486
|
*
|
|
6483
6487
|
* @public
|
|
6484
6488
|
* @param {Decimal} instance
|
|
6485
|
-
* @
|
|
6489
|
+
* @returns {Boolean}
|
|
6486
6490
|
*/
|
|
6487
6491
|
|
|
6488
6492
|
}, {
|
|
@@ -6498,7 +6502,7 @@ module.exports = function () {
|
|
|
6498
6502
|
*
|
|
6499
6503
|
* @public
|
|
6500
6504
|
* @param {Decimal} instance
|
|
6501
|
-
* @
|
|
6505
|
+
* @returns {Boolean}
|
|
6502
6506
|
*/
|
|
6503
6507
|
|
|
6504
6508
|
}, {
|
|
@@ -6888,6 +6892,7 @@ module.exports = function () {
|
|
|
6888
6892
|
/**
|
|
6889
6893
|
* The unique code.
|
|
6890
6894
|
*
|
|
6895
|
+
* @public
|
|
6891
6896
|
* @returns {String}
|
|
6892
6897
|
*/
|
|
6893
6898
|
|
|
@@ -6900,6 +6905,7 @@ module.exports = function () {
|
|
|
6900
6905
|
* Returns true if the provided {@link Enum} argument is equal
|
|
6901
6906
|
* to the instance.
|
|
6902
6907
|
*
|
|
6908
|
+
* @public
|
|
6903
6909
|
* @param {Enum} other
|
|
6904
6910
|
* @returns {boolean}
|
|
6905
6911
|
*/
|
|
@@ -6924,6 +6930,7 @@ module.exports = function () {
|
|
|
6924
6930
|
* Looks up a enumeration item; given the enumeration type and the enumeration
|
|
6925
6931
|
* item's value. If no matching item can be found, a null value is returned.
|
|
6926
6932
|
*
|
|
6933
|
+
* @public
|
|
6927
6934
|
* @param {Function} type - The enumeration type.
|
|
6928
6935
|
* @param {String} code - The enumeration item's code.
|
|
6929
6936
|
* @returns {*|null}
|
|
@@ -6943,6 +6950,7 @@ module.exports = function () {
|
|
|
6943
6950
|
/**
|
|
6944
6951
|
* The description.
|
|
6945
6952
|
*
|
|
6953
|
+
* @public
|
|
6946
6954
|
* @returns {String}
|
|
6947
6955
|
*/
|
|
6948
6956
|
|
|
@@ -6962,6 +6970,7 @@ module.exports = function () {
|
|
|
6962
6970
|
/**
|
|
6963
6971
|
* Returns all of the enumeration's items (given an enumeration type).
|
|
6964
6972
|
*
|
|
6973
|
+
* @public
|
|
6965
6974
|
* @param {Function} type - The enumeration to list.
|
|
6966
6975
|
* @returns {Array}
|
|
6967
6976
|
*/
|
|
@@ -7419,7 +7428,7 @@ module.exports = function () {
|
|
|
7419
7428
|
* Parses the value emitted by {@link Timestamp#toJSON}.
|
|
7420
7429
|
*
|
|
7421
7430
|
* @public
|
|
7422
|
-
* @param {
|
|
7431
|
+
* @param {Number} value
|
|
7423
7432
|
* @returns {Timestamp}
|
|
7424
7433
|
*/
|
|
7425
7434
|
|
|
@@ -8055,7 +8064,7 @@ module.exports = function () {
|
|
|
8055
8064
|
|
|
8056
8065
|
if (typeof itemConstraint === 'function' && itemConstraint !== Function) {
|
|
8057
8066
|
itemValidator = function itemValidator(value, index) {
|
|
8058
|
-
return value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
|
|
8067
|
+
return itemConstraint.prototype !== undefined && value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
|
|
8059
8068
|
};
|
|
8060
8069
|
} else {
|
|
8061
8070
|
itemValidator = function itemValidator(value, index) {
|
|
@@ -8165,7 +8174,7 @@ module.exports = function () {
|
|
|
8165
8174
|
*
|
|
8166
8175
|
* @static
|
|
8167
8176
|
* @param {Object} target - The object to check for existence of the property.
|
|
8168
|
-
* @param {String|Array
|
|
8177
|
+
* @param {String|Array.<String>} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
|
|
8169
8178
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8170
8179
|
* @returns {boolean}
|
|
8171
8180
|
*/
|
|
@@ -8191,7 +8200,7 @@ module.exports = function () {
|
|
|
8191
8200
|
*
|
|
8192
8201
|
* @static
|
|
8193
8202
|
* @param {Object} target - The object to read from.
|
|
8194
|
-
* @param {String|Array
|
|
8203
|
+
* @param {String|Array.<String>} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
|
|
8195
8204
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8196
8205
|
* @returns {*}
|
|
8197
8206
|
*/
|
|
@@ -8226,7 +8235,8 @@ module.exports = function () {
|
|
|
8226
8235
|
*
|
|
8227
8236
|
* @static
|
|
8228
8237
|
* @param {Object} target - The object to write to.
|
|
8229
|
-
* @param {String|Array
|
|
8238
|
+
* @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
|
|
8239
|
+
* @param {*} value - The value to assign.
|
|
8230
8240
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8231
8241
|
*/
|
|
8232
8242
|
write: function write(target, propertyNames, value, separator) {
|
|
@@ -8252,7 +8262,7 @@ module.exports = function () {
|
|
|
8252
8262
|
*
|
|
8253
8263
|
* @static
|
|
8254
8264
|
* @param {Object} target - The object to erase a property from.
|
|
8255
|
-
* @param {String|Array
|
|
8265
|
+
* @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
|
|
8256
8266
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8257
8267
|
*/
|
|
8258
8268
|
erase: function erase(target, propertyNames, separator) {
|
|
@@ -9505,7 +9515,7 @@ module.exports = function () {
|
|
|
9505
9515
|
}
|
|
9506
9516
|
|
|
9507
9517
|
/**
|
|
9508
|
-
* Generates a function suitable for use by JSON.parse.
|
|
9518
|
+
* Generates a function suitable for use by {@link JSON.parse}.
|
|
9509
9519
|
*
|
|
9510
9520
|
* @public
|
|
9511
9521
|
* @returns {Function}
|
|
@@ -13630,9 +13640,9 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
13630
13640
|
|
|
13631
13641
|
mom = createUTC([2000, 1]).day(i);
|
|
13632
13642
|
if (strict && !this._fullWeekdaysParse[i]) {
|
|
13633
|
-
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '
|
|
13634
|
-
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '
|
|
13635
|
-
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '
|
|
13643
|
+
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
|
|
13644
|
+
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
|
|
13645
|
+
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
|
|
13636
13646
|
}
|
|
13637
13647
|
if (!this._weekdaysParse[i]) {
|
|
13638
13648
|
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
|
|
@@ -14435,7 +14445,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
14435
14445
|
|
|
14436
14446
|
function preprocessRFC2822(s) {
|
|
14437
14447
|
// Remove comments and folding whitespace and replace multiple-spaces with a single space
|
|
14438
|
-
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').
|
|
14448
|
+
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
|
|
14439
14449
|
}
|
|
14440
14450
|
|
|
14441
14451
|
function checkWeekday(weekdayStr, parsedInput, config) {
|
|
@@ -16614,7 +16624,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16614
16624
|
// Side effect imports
|
|
16615
16625
|
|
|
16616
16626
|
|
|
16617
|
-
hooks.version = '2.22.
|
|
16627
|
+
hooks.version = '2.22.2';
|
|
16618
16628
|
|
|
16619
16629
|
setHookCallback(createLocal);
|
|
16620
16630
|
|