@barchart/portfolio-api-common 1.2.46 → 1.2.47

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.
@@ -182,11 +182,16 @@ module.exports = (() => {
182
182
 
183
183
  formatters.set(TransactionType.DISTRIBUTION_REINVEST, (t) => {
184
184
  return {
185
+ <<<<<<< HEAD
186
+ shares: t.quantity,
187
+ fee: t.fee
188
+ =======
185
189
  boughtSold: t.quantity,
186
190
  shares: t.snapshot.open.subtract(t.quantity),
187
191
  price: t.dividend.price,
188
192
  fee: t.fee,
189
193
  rate: t.dividend.rate
194
+ >>>>>>> ec3861f5eeab5fdbfa9275d5ef3f5b988b90999b
190
195
  };
191
196
  });
192
197
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.46",
3
+ "version": "1.2.47",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -5134,8 +5134,8 @@ module.exports = function () {
5134
5134
  * Compares two strings (in ascending order), using {@link String#localeCompare}.
5135
5135
  *
5136
5136
  * @static
5137
- * @param {Number} a
5138
- * @param {Number} b
5137
+ * @param {String} a
5138
+ * @param {String} b
5139
5139
  * @returns {Number}
5140
5140
  */
5141
5141
  compareStrings: function compareStrings(a, b) {
@@ -5825,7 +5825,7 @@ module.exports = function () {
5825
5825
  * @returns {String}
5826
5826
  */
5827
5827
  value: function format() {
5828
- return this._year + '-' + leftPad(this._month) + '-' + leftPad(this._day);
5828
+ return leftPad(this._year, 4, '0') + '-' + leftPad(this._month, 2, '0') + '-' + leftPad(this._day, 2, '0');
5829
5829
  }
5830
5830
 
5831
5831
  /**
@@ -5942,7 +5942,7 @@ module.exports = function () {
5942
5942
  *
5943
5943
  * @static
5944
5944
  * @public
5945
- * @return {Day}
5945
+ * @returns {Day}
5946
5946
  */
5947
5947
 
5948
5948
  }, {
@@ -6034,8 +6034,11 @@ module.exports = function () {
6034
6034
 
6035
6035
  var dayRegex = /^([0-9]{4}).?([0-9]{2}).?([0-9]{2})$/;
6036
6036
 
6037
- function leftPad(value) {
6038
- return value < 10 ? '0' + value : '' + value;
6037
+ function leftPad(value, digits, character) {
6038
+ var string = value.toString();
6039
+ var padding = digits - string.length;
6040
+
6041
+ return '' + character.repeat(padding) + string;
6039
6042
  }
6040
6043
 
6041
6044
  var comparator = ComparatorBuilder.startWith(function (a, b) {
@@ -6390,7 +6393,7 @@ module.exports = function () {
6390
6393
  *
6391
6394
  * @public
6392
6395
  * @param {Decimal} instance
6393
- * @return {Boolean}
6396
+ * @returns {Boolean}
6394
6397
  */
6395
6398
  value: function getIsZero(instance) {
6396
6399
  assert.argumentIsRequired(instance, 'instance', Decimal, 'Decimal');
@@ -6403,7 +6406,7 @@ module.exports = function () {
6403
6406
  *
6404
6407
  * @public
6405
6408
  * @param {Decimal} instance
6406
- * @return {Boolean}
6409
+ * @returns {Boolean}
6407
6410
  */
6408
6411
 
6409
6412
  }, {
@@ -6419,7 +6422,7 @@ module.exports = function () {
6419
6422
  *
6420
6423
  * @public
6421
6424
  * @param {Decimal} instance
6422
- * @return {Boolean}
6425
+ * @returns {Boolean}
6423
6426
  */
6424
6427
 
6425
6428
  }, {
@@ -6435,7 +6438,7 @@ module.exports = function () {
6435
6438
  *
6436
6439
  * @public
6437
6440
  * @param {Decimal} instance
6438
- * @return {Boolean}
6441
+ * @returns {Boolean}
6439
6442
  */
6440
6443
 
6441
6444
  }, {
@@ -6451,7 +6454,7 @@ module.exports = function () {
6451
6454
  *
6452
6455
  * @public
6453
6456
  * @param {Decimal} instance
6454
- * @return {Boolean}
6457
+ * @returns {Boolean}
6455
6458
  */
6456
6459
 
6457
6460
  }, {
@@ -6467,7 +6470,7 @@ module.exports = function () {
6467
6470
  *
6468
6471
  * @public
6469
6472
  * @param {Decimal} instance
6470
- * @return {Boolean}
6473
+ * @returns {Boolean}
6471
6474
  */
6472
6475
 
6473
6476
  }, {
@@ -6857,6 +6860,7 @@ module.exports = function () {
6857
6860
  /**
6858
6861
  * The unique code.
6859
6862
  *
6863
+ * @public
6860
6864
  * @returns {String}
6861
6865
  */
6862
6866
 
@@ -6869,6 +6873,7 @@ module.exports = function () {
6869
6873
  * Returns true if the provided {@link Enum} argument is equal
6870
6874
  * to the instance.
6871
6875
  *
6876
+ * @public
6872
6877
  * @param {Enum} other
6873
6878
  * @returns {boolean}
6874
6879
  */
@@ -6893,6 +6898,7 @@ module.exports = function () {
6893
6898
  * Looks up a enumeration item; given the enumeration type and the enumeration
6894
6899
  * item's value. If no matching item can be found, a null value is returned.
6895
6900
  *
6901
+ * @public
6896
6902
  * @param {Function} type - The enumeration type.
6897
6903
  * @param {String} code - The enumeration item's code.
6898
6904
  * @returns {*|null}
@@ -6912,6 +6918,7 @@ module.exports = function () {
6912
6918
  /**
6913
6919
  * The description.
6914
6920
  *
6921
+ * @public
6915
6922
  * @returns {String}
6916
6923
  */
6917
6924
 
@@ -6931,6 +6938,7 @@ module.exports = function () {
6931
6938
  /**
6932
6939
  * Returns all of the enumeration's items (given an enumeration type).
6933
6940
  *
6941
+ * @public
6934
6942
  * @param {Function} type - The enumeration to list.
6935
6943
  * @returns {Array}
6936
6944
  */
@@ -7388,7 +7396,7 @@ module.exports = function () {
7388
7396
  * Parses the value emitted by {@link Timestamp#toJSON}.
7389
7397
  *
7390
7398
  * @public
7391
- * @param {String} value
7399
+ * @param {Number} value
7392
7400
  * @returns {Timestamp}
7393
7401
  */
7394
7402
 
@@ -8024,7 +8032,7 @@ module.exports = function () {
8024
8032
 
8025
8033
  if (typeof itemConstraint === 'function' && itemConstraint !== Function) {
8026
8034
  itemValidator = function itemValidator(value, index) {
8027
- return value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
8035
+ return itemConstraint.prototype !== undefined && value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
8028
8036
  };
8029
8037
  } else {
8030
8038
  itemValidator = function itemValidator(value, index) {
@@ -8134,7 +8142,7 @@ module.exports = function () {
8134
8142
  *
8135
8143
  * @static
8136
8144
  * @param {Object} target - The object to check for existence of the property.
8137
- * @param {String|Array<String>} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
8145
+ * @param {String|Array.<String>} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
8138
8146
  * @param {String=} separator - The separator (defaults to a period character).
8139
8147
  * @returns {boolean}
8140
8148
  */
@@ -8160,7 +8168,7 @@ module.exports = function () {
8160
8168
  *
8161
8169
  * @static
8162
8170
  * @param {Object} target - The object to read from.
8163
- * @param {String|Array<String>} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
8171
+ * @param {String|Array.<String>} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
8164
8172
  * @param {String=} separator - The separator (defaults to a period character).
8165
8173
  * @returns {*}
8166
8174
  */
@@ -8195,7 +8203,8 @@ module.exports = function () {
8195
8203
  *
8196
8204
  * @static
8197
8205
  * @param {Object} target - The object to write to.
8198
- * @param {String|Array<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
8206
+ * @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
8207
+ * @param {*} value - The value to assign.
8199
8208
  * @param {String=} separator - The separator (defaults to a period character).
8200
8209
  */
8201
8210
  write: function write(target, propertyNames, value, separator) {
@@ -8221,7 +8230,7 @@ module.exports = function () {
8221
8230
  *
8222
8231
  * @static
8223
8232
  * @param {Object} target - The object to erase a property from.
8224
- * @param {String|Array<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
8233
+ * @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
8225
8234
  * @param {String=} separator - The separator (defaults to a period character).
8226
8235
  */
8227
8236
  erase: function erase(target, propertyNames, separator) {
@@ -9474,7 +9483,7 @@ module.exports = function () {
9474
9483
  }
9475
9484
 
9476
9485
  /**
9477
- * Generates a function suitable for use by JSON.parse.
9486
+ * Generates a function suitable for use by {@link JSON.parse}.
9478
9487
  *
9479
9488
  * @public
9480
9489
  * @returns {Function}
@@ -13599,9 +13608,9 @@ moment.tz.load(require('./data/packed/latest.json'));
13599
13608
 
13600
13609
  mom = createUTC([2000, 1]).day(i);
13601
13610
  if (strict && !this._fullWeekdaysParse[i]) {
13602
- this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
13603
- this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
13604
- this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
13611
+ this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
13612
+ this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
13613
+ this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
13605
13614
  }
13606
13615
  if (!this._weekdaysParse[i]) {
13607
13616
  regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
@@ -14404,7 +14413,7 @@ moment.tz.load(require('./data/packed/latest.json'));
14404
14413
 
14405
14414
  function preprocessRFC2822(s) {
14406
14415
  // Remove comments and folding whitespace and replace multiple-spaces with a single space
14407
- return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim();
14416
+ return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
14408
14417
  }
14409
14418
 
14410
14419
  function checkWeekday(weekdayStr, parsedInput, config) {
@@ -16583,7 +16592,7 @@ moment.tz.load(require('./data/packed/latest.json'));
16583
16592
  // Side effect imports
16584
16593
 
16585
16594
 
16586
- hooks.version = '2.22.1';
16595
+ hooks.version = '2.22.2';
16587
16596
 
16588
16597
  setHookCallback(createLocal);
16589
16598