@barchart/portfolio-api-common 1.2.43 → 1.2.44

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.
@@ -211,6 +211,8 @@ module.exports = (() => {
211
211
  .withField('sequence', DataType.NUMBER, true)
212
212
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
213
213
  .withField('instrument.name', DataType.STRING, true)
214
+ .withField('instrument.exchange', DataType.STRING, true)
215
+ .withField('instrument.code', DataType.NUMBER, true)
214
216
  .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
215
217
  .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
216
218
  .withField('instrument.symbol.barchart', DataType.STRING, true)
@@ -257,6 +259,8 @@ module.exports = (() => {
257
259
  .withField('sequence', DataType.NUMBER, true)
258
260
  .withField('type', DataType.forEnum(TransactionType, 'TransactionType'))
259
261
  .withField('instrument.name', DataType.STRING, true)
262
+ .withField('instrument.exchange', DataType.STRING, true)
263
+ .withField('instrument.code', DataType.NUMBER, true)
260
264
  .withField('instrument.type', DataType.forEnum(InstrumentType, 'InstrumentType'), true)
261
265
  .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
262
266
  .withField('instrument.symbol.barchart', DataType.STRING, true)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.43",
3
+ "version": "1.2.44",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -4674,8 +4674,8 @@ module.exports = function () {
4674
4674
  * Compares two strings (in ascending order), using {@link String#localeCompare}.
4675
4675
  *
4676
4676
  * @static
4677
- * @param {Number} a
4678
- * @param {Number} b
4677
+ * @param {String} a
4678
+ * @param {String} b
4679
4679
  * @returns {Number}
4680
4680
  */
4681
4681
  compareStrings: function compareStrings(a, b) {
@@ -5279,7 +5279,7 @@ module.exports = function () {
5279
5279
  * @returns {String}
5280
5280
  */
5281
5281
  value: function format() {
5282
- return this._year + '-' + leftPad(this._month) + '-' + leftPad(this._day);
5282
+ return leftPad(this._year, 4, '0') + '-' + leftPad(this._month, 2, '0') + '-' + leftPad(this._day, 2, '0');
5283
5283
  }
5284
5284
 
5285
5285
  /**
@@ -5396,7 +5396,7 @@ module.exports = function () {
5396
5396
  *
5397
5397
  * @static
5398
5398
  * @public
5399
- * @return {Day}
5399
+ * @returns {Day}
5400
5400
  */
5401
5401
 
5402
5402
  }, {
@@ -5488,8 +5488,11 @@ module.exports = function () {
5488
5488
 
5489
5489
  var dayRegex = /^([0-9]{4}).?([0-9]{2}).?([0-9]{2})$/;
5490
5490
 
5491
- function leftPad(value) {
5492
- return value < 10 ? '0' + value : '' + value;
5491
+ function leftPad(value, digits, character) {
5492
+ var string = value.toString();
5493
+ var padding = digits - string.length;
5494
+
5495
+ return '' + character.repeat(padding) + string;
5493
5496
  }
5494
5497
 
5495
5498
  var comparator = ComparatorBuilder.startWith(function (a, b) {
@@ -5844,7 +5847,7 @@ module.exports = function () {
5844
5847
  *
5845
5848
  * @public
5846
5849
  * @param {Decimal} instance
5847
- * @return {Boolean}
5850
+ * @returns {Boolean}
5848
5851
  */
5849
5852
  value: function getIsZero(instance) {
5850
5853
  assert.argumentIsRequired(instance, 'instance', Decimal, 'Decimal');
@@ -5857,7 +5860,7 @@ module.exports = function () {
5857
5860
  *
5858
5861
  * @public
5859
5862
  * @param {Decimal} instance
5860
- * @return {Boolean}
5863
+ * @returns {Boolean}
5861
5864
  */
5862
5865
 
5863
5866
  }, {
@@ -5873,7 +5876,7 @@ module.exports = function () {
5873
5876
  *
5874
5877
  * @public
5875
5878
  * @param {Decimal} instance
5876
- * @return {Boolean}
5879
+ * @returns {Boolean}
5877
5880
  */
5878
5881
 
5879
5882
  }, {
@@ -5889,7 +5892,7 @@ module.exports = function () {
5889
5892
  *
5890
5893
  * @public
5891
5894
  * @param {Decimal} instance
5892
- * @return {Boolean}
5895
+ * @returns {Boolean}
5893
5896
  */
5894
5897
 
5895
5898
  }, {
@@ -5905,7 +5908,7 @@ module.exports = function () {
5905
5908
  *
5906
5909
  * @public
5907
5910
  * @param {Decimal} instance
5908
- * @return {Boolean}
5911
+ * @returns {Boolean}
5909
5912
  */
5910
5913
 
5911
5914
  }, {
@@ -5921,7 +5924,7 @@ module.exports = function () {
5921
5924
  *
5922
5925
  * @public
5923
5926
  * @param {Decimal} instance
5924
- * @return {Boolean}
5927
+ * @returns {Boolean}
5925
5928
  */
5926
5929
 
5927
5930
  }, {
@@ -6311,6 +6314,7 @@ module.exports = function () {
6311
6314
  /**
6312
6315
  * The unique code.
6313
6316
  *
6317
+ * @public
6314
6318
  * @returns {String}
6315
6319
  */
6316
6320
 
@@ -6323,6 +6327,7 @@ module.exports = function () {
6323
6327
  * Returns true if the provided {@link Enum} argument is equal
6324
6328
  * to the instance.
6325
6329
  *
6330
+ * @public
6326
6331
  * @param {Enum} other
6327
6332
  * @returns {boolean}
6328
6333
  */
@@ -6347,6 +6352,7 @@ module.exports = function () {
6347
6352
  * Looks up a enumeration item; given the enumeration type and the enumeration
6348
6353
  * item's value. If no matching item can be found, a null value is returned.
6349
6354
  *
6355
+ * @public
6350
6356
  * @param {Function} type - The enumeration type.
6351
6357
  * @param {String} code - The enumeration item's code.
6352
6358
  * @returns {*|null}
@@ -6366,6 +6372,7 @@ module.exports = function () {
6366
6372
  /**
6367
6373
  * The description.
6368
6374
  *
6375
+ * @public
6369
6376
  * @returns {String}
6370
6377
  */
6371
6378
 
@@ -6385,6 +6392,7 @@ module.exports = function () {
6385
6392
  /**
6386
6393
  * Returns all of the enumeration's items (given an enumeration type).
6387
6394
  *
6395
+ * @public
6388
6396
  * @param {Function} type - The enumeration to list.
6389
6397
  * @returns {Array}
6390
6398
  */
@@ -7232,7 +7240,7 @@ module.exports = function () {
7232
7240
 
7233
7241
  if (typeof itemConstraint === 'function' && itemConstraint !== Function) {
7234
7242
  itemValidator = function itemValidator(value, index) {
7235
- return value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
7243
+ return itemConstraint.prototype !== undefined && value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
7236
7244
  };
7237
7245
  } else {
7238
7246
  itemValidator = function itemValidator(value, index) {