@barchart/portfolio-api-common 1.2.60 → 1.2.64

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.
@@ -19,11 +19,12 @@ module.exports = (() => {
19
19
  * @param {Boolean} canSwitchDirection
20
20
  * @param {Boolean} usesSymbols
21
21
  * @param {Boolean} hasCorporateActions
22
- * @param {Number} closeFractional
22
+ * @param {Boolean} closeFractional
23
+ * @param {Boolean} roundQuantity
23
24
  * @param {Function} generator
24
25
  */
25
26
  class InstrumentType extends Enum {
26
- constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, generator) {
27
+ constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, generator) {
27
28
  super(code, description);
28
29
 
29
30
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
@@ -33,6 +34,7 @@ module.exports = (() => {
33
34
  assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
34
35
  assert.argumentIsRequired(hasCorporateActions, 'hasCorporateActions', Boolean);
35
36
  assert.argumentIsRequired(closeFractional, 'closeFractional', Boolean);
37
+ assert.argumentIsRequired(roundQuantity, 'roundQuantity', Boolean);
36
38
  assert.argumentIsRequired(generator, 'generator', Function);
37
39
 
38
40
  this._alternateDescription = alternateDescription;
@@ -42,6 +44,7 @@ module.exports = (() => {
42
44
  this._usesSymbols = usesSymbols;
43
45
  this._hasCorporateActions = hasCorporateActions;
44
46
  this._closeFractional = closeFractional;
47
+ this._roundQuantity = roundQuantity;
45
48
 
46
49
  this._generator = generator;
47
50
  }
@@ -118,6 +121,16 @@ module.exports = (() => {
118
121
  return this._closeFractional;
119
122
  }
120
123
 
124
+ /**
125
+ * Indicates transaction quantities should be rounded.
126
+ *
127
+ * @public
128
+ * @returns {Boolean}
129
+ */
130
+ get roundQuantity() {
131
+ return this._roundQuantity;
132
+ }
133
+
121
134
  /**
122
135
  * Generates an identifier for the instrument.
123
136
  *
@@ -215,10 +228,10 @@ module.exports = (() => {
215
228
  }
216
229
  }
217
230
 
218
- const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
219
- const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
220
- const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
221
- const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
231
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
232
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
233
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
234
+ const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
222
235
 
223
236
  const map = { };
224
237
 
@@ -2,8 +2,7 @@ const array = require('@barchart/common-js/lang/array'),
2
2
  assert = require('@barchart/common-js/lang/assert'),
3
3
  Day = require('@barchart/common-js/lang/Day'),
4
4
  Decimal = require('@barchart/common-js/lang/Decimal'),
5
- Enum = require('@barchart/common-js/lang/Enum'),
6
- is = require('@barchart/common-js/lang/is');
5
+ Enum = require('@barchart/common-js/lang/Enum');
7
6
 
8
7
  module.exports = (() => {
9
8
  'use strict';
@@ -1,5 +1,4 @@
1
- const assert = require('@barchart/common-js/lang/assert'),
2
- Enum = require('@barchart/common-js/lang/Enum');
1
+ const Enum = require('@barchart/common-js/lang/Enum');
3
2
 
4
3
  module.exports = (() => {
5
4
  'use strict';
@@ -4,7 +4,6 @@ const array = require('@barchart/common-js/lang/array'),
4
4
  formatter = require('@barchart/common-js/lang/formatter');
5
5
 
6
6
  module.exports = (() => {
7
-
8
7
  /**
9
8
  * Static utilities for formatting position summary records (into groups based on
10
9
  * instrument type)
@@ -1,8 +1,6 @@
1
- const assert = require('@barchart/common-js/lang/assert'),
2
- Currency = require('@barchart/common-js/lang/Currency'),
1
+ const Currency = require('@barchart/common-js/lang/Currency'),
3
2
  DataType = require('@barchart/common-js/serialization/json/DataType'),
4
3
  Enum = require('@barchart/common-js/lang/Enum'),
5
- is = require('@barchart/common-js/lang/is'),
6
4
  Schema = require('@barchart/common-js/serialization/json/Schema'),
7
5
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder'),
8
6
  Timezones = require('@barchart/common-js/lang/Timezones');
@@ -1,8 +1,6 @@
1
- const assert = require('@barchart/common-js/lang/assert'),
2
- Currency = require('@barchart/common-js/lang/Currency'),
1
+ const Currency = require('@barchart/common-js/lang/Currency'),
3
2
  DataType = require('@barchart/common-js/serialization/json/DataType'),
4
3
  Enum = require('@barchart/common-js/lang/Enum'),
5
- is = require('@barchart/common-js/lang/is'),
6
4
  Schema = require('@barchart/common-js/serialization/json/Schema'),
7
5
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
8
6
 
@@ -1,8 +1,6 @@
1
- const assert = require('@barchart/common-js/lang/assert'),
2
- Currency = require('@barchart/common-js/lang/Currency'),
1
+ const Currency = require('@barchart/common-js/lang/Currency'),
3
2
  DataType = require('@barchart/common-js/serialization/json/DataType'),
4
3
  Enum = require('@barchart/common-js/lang/Enum'),
5
- is = require('@barchart/common-js/lang/is'),
6
4
  Schema = require('@barchart/common-js/serialization/json/Schema'),
7
5
  SchemaBuilder = require('@barchart/common-js/serialization/json/builders/SchemaBuilder');
8
6
 
@@ -66,13 +64,15 @@ module.exports = (() => {
66
64
  .withField('user', DataType.STRING)
67
65
  .withField('portfolio', DataType.STRING)
68
66
  .withField('position', DataType.STRING)
69
- .withField('instrument.id', DataType.STRING)
70
- .withField('instrument.name', DataType.STRING)
71
- .withField('instrument.type', DataType.STRING)
72
- .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
67
+
68
+ .withField('instrument.id', DataType.STRING, true)
69
+ .withField('instrument.name', DataType.STRING, true)
70
+ .withField('instrument.type', DataType.STRING, true)
71
+ .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
73
72
  .withField('instrument.delist', DataType.DAY, true)
74
73
  .withField('instrument.symbol.barchart', DataType.STRING, true)
75
74
  .withField('instrument.symbol.display', DataType.STRING, true)
75
+
76
76
  .withField('frame', DataType.forEnum(PositionSummaryFrame, 'PositionSummaryFrame'))
77
77
  .withField('start.date', DataType.DAY)
78
78
  .withField('start.sequence', DataType.NUMBER)
@@ -100,13 +100,15 @@ module.exports = (() => {
100
100
  .withField('user', DataType.STRING)
101
101
  .withField('portfolio', DataType.STRING)
102
102
  .withField('position', DataType.STRING)
103
- .withField('instrument.id', DataType.STRING)
104
- .withField('instrument.name', DataType.STRING)
105
- .withField('instrument.type', DataType.STRING)
106
- .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'))
103
+
104
+ .withField('instrument.id', DataType.STRING, true)
105
+ .withField('instrument.name', DataType.STRING, true)
106
+ .withField('instrument.type', DataType.STRING, true)
107
+ .withField('instrument.currency', DataType.forEnum(Currency, 'Currency'), true)
107
108
  .withField('instrument.delist', DataType.DAY, true)
108
109
  .withField('instrument.symbol.barchart', DataType.STRING, true)
109
110
  .withField('instrument.symbol.display', DataType.STRING, true)
111
+
110
112
  .withField('frame', DataType.forEnum(PositionSummaryFrame, 'PositionSummaryFrame'))
111
113
  .withField('start.date', DataType.DAY)
112
114
  .withField('start.sequence', DataType.NUMBER)
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.60",
3
+ "version": "1.2.64",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -20,11 +20,12 @@ module.exports = (() => {
20
20
  * @param {Boolean} canSwitchDirection
21
21
  * @param {Boolean} usesSymbols
22
22
  * @param {Boolean} hasCorporateActions
23
- * @param {Number} closeFractional
23
+ * @param {Boolean} closeFractional
24
+ * @param {Boolean} roundQuantity
24
25
  * @param {Function} generator
25
26
  */
26
27
  class InstrumentType extends Enum {
27
- constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, generator) {
28
+ constructor(code, description, alternateDescription, canReinvest, canShort, canSwitchDirection, usesSymbols, hasCorporateActions, closeFractional, roundQuantity, generator) {
28
29
  super(code, description);
29
30
 
30
31
  assert.argumentIsRequired(alternateDescription, 'alternateDescription', String);
@@ -34,6 +35,7 @@ module.exports = (() => {
34
35
  assert.argumentIsRequired(usesSymbols, 'usesSymbols', Boolean);
35
36
  assert.argumentIsRequired(hasCorporateActions, 'hasCorporateActions', Boolean);
36
37
  assert.argumentIsRequired(closeFractional, 'closeFractional', Boolean);
38
+ assert.argumentIsRequired(roundQuantity, 'roundQuantity', Boolean);
37
39
  assert.argumentIsRequired(generator, 'generator', Function);
38
40
 
39
41
  this._alternateDescription = alternateDescription;
@@ -43,6 +45,7 @@ module.exports = (() => {
43
45
  this._usesSymbols = usesSymbols;
44
46
  this._hasCorporateActions = hasCorporateActions;
45
47
  this._closeFractional = closeFractional;
48
+ this._roundQuantity = roundQuantity;
46
49
 
47
50
  this._generator = generator;
48
51
  }
@@ -119,6 +122,16 @@ module.exports = (() => {
119
122
  return this._closeFractional;
120
123
  }
121
124
 
125
+ /**
126
+ * Indicates transaction quantities should be rounded.
127
+ *
128
+ * @public
129
+ * @returns {Boolean}
130
+ */
131
+ get roundQuantity() {
132
+ return this._roundQuantity;
133
+ }
134
+
122
135
  /**
123
136
  * Generates an identifier for the instrument.
124
137
  *
@@ -216,10 +229,10 @@ module.exports = (() => {
216
229
  }
217
230
  }
218
231
 
219
- const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
220
- const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
221
- const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
222
- const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
232
+ const cash = new InstrumentType('CASH', 'cash', 'Cash', false, false, true, false, false, false, false, (instrument) => `BARCHART-${instrument.type.code}-${instrument.currency.code}`);
233
+ const equity = new InstrumentType('EQUITY', 'equity', 'Equities', true, true, false, true, true, true, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
234
+ const fund = new InstrumentType('FUND', 'mutual fund', 'Funds', true, false, false, true, true, false, true, (instrument) => `BARCHART-${instrument.type.code}-${instrument.symbol.barchart}`);
235
+ const other = new InstrumentType('OTHER', 'other', 'Other', false, false, false, false, false, false, true, (instrument) => `BARCHART-${instrument.type.code}-${uuid.v4()}`);
223
236
 
224
237
  const map = { };
225
238
 
@@ -366,8 +379,7 @@ const array = require('@barchart/common-js/lang/array'),
366
379
  assert = require('@barchart/common-js/lang/assert'),
367
380
  Day = require('@barchart/common-js/lang/Day'),
368
381
  Decimal = require('@barchart/common-js/lang/Decimal'),
369
- Enum = require('@barchart/common-js/lang/Enum'),
370
- is = require('@barchart/common-js/lang/is');
382
+ Enum = require('@barchart/common-js/lang/Enum');
371
383
 
372
384
  module.exports = (() => {
373
385
  'use strict';
@@ -634,7 +646,7 @@ module.exports = (() => {
634
646
  return PositionSummaryFrame;
635
647
  })();
636
648
 
637
- },{"@barchart/common-js/lang/Day":21,"@barchart/common-js/lang/Decimal":22,"@barchart/common-js/lang/Enum":24,"@barchart/common-js/lang/array":28,"@barchart/common-js/lang/assert":29,"@barchart/common-js/lang/is":33}],4:[function(require,module,exports){
649
+ },{"@barchart/common-js/lang/Day":21,"@barchart/common-js/lang/Decimal":22,"@barchart/common-js/lang/Enum":24,"@barchart/common-js/lang/array":28,"@barchart/common-js/lang/assert":29}],4:[function(require,module,exports){
638
650
  const assert = require('@barchart/common-js/lang/assert'),
639
651
  Enum = require('@barchart/common-js/lang/Enum');
640
652
 
@@ -5167,8 +5179,8 @@ module.exports = function () {
5167
5179
  * Compares two strings (in ascending order), using {@link String#localeCompare}.
5168
5180
  *
5169
5181
  * @static
5170
- * @param {Number} a
5171
- * @param {Number} b
5182
+ * @param {String} a
5183
+ * @param {String} b
5172
5184
  * @returns {Number}
5173
5185
  */
5174
5186
  compareStrings: function compareStrings(a, b) {
@@ -5858,7 +5870,7 @@ module.exports = function () {
5858
5870
  * @returns {String}
5859
5871
  */
5860
5872
  value: function format() {
5861
- return this._year + '-' + leftPad(this._month) + '-' + leftPad(this._day);
5873
+ return leftPad(this._year, 4, '0') + '-' + leftPad(this._month, 2, '0') + '-' + leftPad(this._day, 2, '0');
5862
5874
  }
5863
5875
 
5864
5876
  /**
@@ -5975,7 +5987,7 @@ module.exports = function () {
5975
5987
  *
5976
5988
  * @static
5977
5989
  * @public
5978
- * @return {Day}
5990
+ * @returns {Day}
5979
5991
  */
5980
5992
 
5981
5993
  }, {
@@ -6067,8 +6079,11 @@ module.exports = function () {
6067
6079
 
6068
6080
  var dayRegex = /^([0-9]{4}).?([0-9]{2}).?([0-9]{2})$/;
6069
6081
 
6070
- function leftPad(value) {
6071
- return value < 10 ? '0' + value : '' + value;
6082
+ function leftPad(value, digits, character) {
6083
+ var string = value.toString();
6084
+ var padding = digits - string.length;
6085
+
6086
+ return '' + character.repeat(padding) + string;
6072
6087
  }
6073
6088
 
6074
6089
  var comparator = ComparatorBuilder.startWith(function (a, b) {
@@ -6234,15 +6249,17 @@ module.exports = function () {
6234
6249
  *
6235
6250
  * @public
6236
6251
  * @param {Boolean=} approximate
6252
+ * @param {Number=} places
6237
6253
  * @returns {Boolean}
6238
6254
  */
6239
6255
 
6240
6256
  }, {
6241
6257
  key: 'getIsZero',
6242
- value: function getIsZero(approximate) {
6258
+ value: function getIsZero(approximate, places) {
6243
6259
  assert.argumentIsOptional(approximate, 'approximate', Boolean);
6260
+ assert.argumentIsOptional(places, 'places', Number);
6244
6261
 
6245
- return this._big.eq(zero) || is.boolean(approximate) && approximate && this.round(20, RoundingMode.NORMAL).getIsZero();
6262
+ return this._big.eq(zero) || is.boolean(approximate) && approximate && this.round(places || Big.DP, RoundingMode.NORMAL).getIsZero();
6246
6263
  }
6247
6264
 
6248
6265
  /**
@@ -6341,6 +6358,43 @@ module.exports = function () {
6341
6358
  return this._big.eq(getBig(other));
6342
6359
  }
6343
6360
 
6361
+ /**
6362
+ * Returns true if the current instance is an integer (i.e. has no decimal
6363
+ * component).
6364
+ *
6365
+ * @public
6366
+ * @return {Boolean}
6367
+ */
6368
+
6369
+ }, {
6370
+ key: 'getIsInteger',
6371
+ value: function getIsInteger() {
6372
+ return this.getIsEqual(this.round(0));
6373
+ }
6374
+
6375
+ /**
6376
+ * Returns the number of decimal places used.
6377
+ *
6378
+ * @public
6379
+ * @returns {Number}
6380
+ */
6381
+
6382
+ }, {
6383
+ key: 'getDecimalPlaces',
6384
+ value: function getDecimalPlaces() {
6385
+ var matches = this.toFixed().match(/-?\d*\.(\d*)/);
6386
+
6387
+ var returnVal = void 0;
6388
+
6389
+ if (matches === null) {
6390
+ returnVal = 0;
6391
+ } else {
6392
+ returnVal = matches[1].length;
6393
+ }
6394
+
6395
+ return returnVal;
6396
+ }
6397
+
6344
6398
  /**
6345
6399
  * Emits a floating point value that approximates the value of the current
6346
6400
  * instance.
@@ -6423,7 +6477,7 @@ module.exports = function () {
6423
6477
  *
6424
6478
  * @public
6425
6479
  * @param {Decimal} instance
6426
- * @return {Boolean}
6480
+ * @returns {Boolean}
6427
6481
  */
6428
6482
  value: function getIsZero(instance) {
6429
6483
  assert.argumentIsRequired(instance, 'instance', Decimal, 'Decimal');
@@ -6436,7 +6490,7 @@ module.exports = function () {
6436
6490
  *
6437
6491
  * @public
6438
6492
  * @param {Decimal} instance
6439
- * @return {Boolean}
6493
+ * @returns {Boolean}
6440
6494
  */
6441
6495
 
6442
6496
  }, {
@@ -6452,7 +6506,7 @@ module.exports = function () {
6452
6506
  *
6453
6507
  * @public
6454
6508
  * @param {Decimal} instance
6455
- * @return {Boolean}
6509
+ * @returns {Boolean}
6456
6510
  */
6457
6511
 
6458
6512
  }, {
@@ -6468,7 +6522,7 @@ module.exports = function () {
6468
6522
  *
6469
6523
  * @public
6470
6524
  * @param {Decimal} instance
6471
- * @return {Boolean}
6525
+ * @returns {Boolean}
6472
6526
  */
6473
6527
 
6474
6528
  }, {
@@ -6484,7 +6538,7 @@ module.exports = function () {
6484
6538
  *
6485
6539
  * @public
6486
6540
  * @param {Decimal} instance
6487
- * @return {Boolean}
6541
+ * @returns {Boolean}
6488
6542
  */
6489
6543
 
6490
6544
  }, {
@@ -6500,7 +6554,7 @@ module.exports = function () {
6500
6554
  *
6501
6555
  * @public
6502
6556
  * @param {Decimal} instance
6503
- * @return {Boolean}
6557
+ * @returns {Boolean}
6504
6558
  */
6505
6559
 
6506
6560
  }, {
@@ -6890,6 +6944,7 @@ module.exports = function () {
6890
6944
  /**
6891
6945
  * The unique code.
6892
6946
  *
6947
+ * @public
6893
6948
  * @returns {String}
6894
6949
  */
6895
6950
 
@@ -6902,6 +6957,7 @@ module.exports = function () {
6902
6957
  * Returns true if the provided {@link Enum} argument is equal
6903
6958
  * to the instance.
6904
6959
  *
6960
+ * @public
6905
6961
  * @param {Enum} other
6906
6962
  * @returns {boolean}
6907
6963
  */
@@ -6926,6 +6982,7 @@ module.exports = function () {
6926
6982
  * Looks up a enumeration item; given the enumeration type and the enumeration
6927
6983
  * item's value. If no matching item can be found, a null value is returned.
6928
6984
  *
6985
+ * @public
6929
6986
  * @param {Function} type - The enumeration type.
6930
6987
  * @param {String} code - The enumeration item's code.
6931
6988
  * @returns {*|null}
@@ -6945,6 +7002,7 @@ module.exports = function () {
6945
7002
  /**
6946
7003
  * The description.
6947
7004
  *
7005
+ * @public
6948
7006
  * @returns {String}
6949
7007
  */
6950
7008
 
@@ -6964,6 +7022,7 @@ module.exports = function () {
6964
7022
  /**
6965
7023
  * Returns all of the enumeration's items (given an enumeration type).
6966
7024
  *
7025
+ * @public
6967
7026
  * @param {Function} type - The enumeration to list.
6968
7027
  * @returns {Array}
6969
7028
  */
@@ -7421,7 +7480,7 @@ module.exports = function () {
7421
7480
  * Parses the value emitted by {@link Timestamp#toJSON}.
7422
7481
  *
7423
7482
  * @public
7424
- * @param {String} value
7483
+ * @param {Number} value
7425
7484
  * @returns {Timestamp}
7426
7485
  */
7427
7486
 
@@ -8057,7 +8116,7 @@ module.exports = function () {
8057
8116
 
8058
8117
  if (typeof itemConstraint === 'function' && itemConstraint !== Function) {
8059
8118
  itemValidator = function itemValidator(value, index) {
8060
- return value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
8119
+ return itemConstraint.prototype !== undefined && value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
8061
8120
  };
8062
8121
  } else {
8063
8122
  itemValidator = function itemValidator(value, index) {
@@ -8167,7 +8226,7 @@ module.exports = function () {
8167
8226
  *
8168
8227
  * @static
8169
8228
  * @param {Object} target - The object to check for existence of the property.
8170
- * @param {String|Array<String>} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
8229
+ * @param {String|Array.<String>} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
8171
8230
  * @param {String=} separator - The separator (defaults to a period character).
8172
8231
  * @returns {boolean}
8173
8232
  */
@@ -8193,7 +8252,7 @@ module.exports = function () {
8193
8252
  *
8194
8253
  * @static
8195
8254
  * @param {Object} target - The object to read from.
8196
- * @param {String|Array<String>} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
8255
+ * @param {String|Array.<String>} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
8197
8256
  * @param {String=} separator - The separator (defaults to a period character).
8198
8257
  * @returns {*}
8199
8258
  */
@@ -8228,7 +8287,8 @@ module.exports = function () {
8228
8287
  *
8229
8288
  * @static
8230
8289
  * @param {Object} target - The object to write to.
8231
- * @param {String|Array<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
8290
+ * @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
8291
+ * @param {*} value - The value to assign.
8232
8292
  * @param {String=} separator - The separator (defaults to a period character).
8233
8293
  */
8234
8294
  write: function write(target, propertyNames, value, separator) {
@@ -8254,7 +8314,7 @@ module.exports = function () {
8254
8314
  *
8255
8315
  * @static
8256
8316
  * @param {Object} target - The object to erase a property from.
8257
- * @param {String|Array<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
8317
+ * @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
8258
8318
  * @param {String=} separator - The separator (defaults to a period character).
8259
8319
  */
8260
8320
  erase: function erase(target, propertyNames, separator) {
@@ -9507,7 +9567,7 @@ module.exports = function () {
9507
9567
  }
9508
9568
 
9509
9569
  /**
9510
- * Generates a function suitable for use by JSON.parse.
9570
+ * Generates a function suitable for use by {@link JSON.parse}.
9511
9571
  *
9512
9572
  * @public
9513
9573
  * @returns {Function}
@@ -13632,9 +13692,9 @@ moment.tz.load(require('./data/packed/latest.json'));
13632
13692
 
13633
13693
  mom = createUTC([2000, 1]).day(i);
13634
13694
  if (strict && !this._fullWeekdaysParse[i]) {
13635
- this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
13636
- this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
13637
- this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
13695
+ this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\\.?') + '$', 'i');
13696
+ this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\\.?') + '$', 'i');
13697
+ this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\\.?') + '$', 'i');
13638
13698
  }
13639
13699
  if (!this._weekdaysParse[i]) {
13640
13700
  regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
@@ -14437,7 +14497,7 @@ moment.tz.load(require('./data/packed/latest.json'));
14437
14497
 
14438
14498
  function preprocessRFC2822(s) {
14439
14499
  // Remove comments and folding whitespace and replace multiple-spaces with a single space
14440
- return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim();
14500
+ return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').replace(/^\s\s*/, '').replace(/\s\s*$/, '');
14441
14501
  }
14442
14502
 
14443
14503
  function checkWeekday(weekdayStr, parsedInput, config) {
@@ -16616,7 +16676,7 @@ moment.tz.load(require('./data/packed/latest.json'));
16616
16676
  // Side effect imports
16617
16677
 
16618
16678
 
16619
- hooks.version = '2.22.1';
16679
+ hooks.version = '2.22.2';
16620
16680
 
16621
16681
  setHookCallback(createLocal);
16622
16682