@barchart/portfolio-api-common 1.2.48 → 1.2.52
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.
|
@@ -192,7 +192,7 @@ module.exports = (() => {
|
|
|
192
192
|
} else if (code === 5 || code == 15) {
|
|
193
193
|
return InstrumentType.FUND;
|
|
194
194
|
} else {
|
|
195
|
-
throw new Error(
|
|
195
|
+
throw new Error(`Unable to determine InstrumentType for [ ${code} ]`);
|
|
196
196
|
}
|
|
197
197
|
}
|
|
198
198
|
|
|
@@ -12,6 +12,7 @@ module.exports = (() => {
|
|
|
12
12
|
* @param {String} code
|
|
13
13
|
* @param {String} description
|
|
14
14
|
* @param {String} display
|
|
15
|
+
* @param {Number} sequence
|
|
15
16
|
* @param {Boolean} purchase
|
|
16
17
|
* @param {Boolean} sale
|
|
17
18
|
* @param {Boolean} income
|
|
@@ -21,12 +22,14 @@ module.exports = (() => {
|
|
|
21
22
|
* @param {Boolean} corporateAction
|
|
22
23
|
* @param {Boolean} initial
|
|
23
24
|
* @param {Boolean} significant
|
|
24
|
-
|
|
25
|
+
* @param {Boolean} eod
|
|
26
|
+
*/
|
|
25
27
|
class TransactionType extends Enum {
|
|
26
|
-
constructor(code, description, display, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant) {
|
|
28
|
+
constructor(code, description, display, sequence, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant) {
|
|
27
29
|
super(code, description);
|
|
28
30
|
|
|
29
31
|
assert.argumentIsRequired(display, 'display', String);
|
|
32
|
+
assert.argumentIsRequired(sequence, 'sequence', Number);
|
|
30
33
|
assert.argumentIsRequired(purchase, 'purchase', Boolean);
|
|
31
34
|
assert.argumentIsRequired(sale, 'sale', Boolean);
|
|
32
35
|
assert.argumentIsRequired(income, 'income', Boolean);
|
|
@@ -38,6 +41,7 @@ module.exports = (() => {
|
|
|
38
41
|
assert.argumentIsRequired(significant, 'significant', Boolean);
|
|
39
42
|
|
|
40
43
|
this._display = display;
|
|
44
|
+
this._sequence = sequence;
|
|
41
45
|
this._purchase = purchase;
|
|
42
46
|
this._sale = sale;
|
|
43
47
|
this._income = income;
|
|
@@ -59,6 +63,17 @@ module.exports = (() => {
|
|
|
59
63
|
return this._display;
|
|
60
64
|
}
|
|
61
65
|
|
|
66
|
+
/**
|
|
67
|
+
* Specifies ordering when multiple transactions occur on the same day, for
|
|
68
|
+
* the same position.
|
|
69
|
+
*
|
|
70
|
+
* @public
|
|
71
|
+
* @returns {Number}
|
|
72
|
+
*/
|
|
73
|
+
get sequence() {
|
|
74
|
+
return this._sequence;
|
|
75
|
+
}
|
|
76
|
+
|
|
62
77
|
/**
|
|
63
78
|
* Indicates if the transaction was a trade.
|
|
64
79
|
*
|
|
@@ -376,28 +391,28 @@ module.exports = (() => {
|
|
|
376
391
|
}
|
|
377
392
|
}
|
|
378
393
|
|
|
379
|
-
const buy = new TransactionType('B', 'Buy', 'Buy', true, false, false, true, false, false, false, true, true);
|
|
380
|
-
const sell = new TransactionType('S', 'Sell', 'Sell', false, true, false, false, true, false, false, false, true);
|
|
381
|
-
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', true, false, false, false, true, false, false, false, true);
|
|
382
|
-
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', false, true, false, true, false, false, false, true, true);
|
|
383
|
-
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', false, false, true, false, false, false, true, false, false);
|
|
384
|
-
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', false, false, false, true, false, false, true, false, false);
|
|
385
|
-
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', false, false, false, true, false, false, true, false, false);
|
|
386
|
-
const split = new TransactionType('SP', 'Split', 'Split', false, false, false, true, false, false, true, false, false);
|
|
387
|
-
const fee = new TransactionType('F', 'Fee', 'Fee', false, false, false, false, false, true, false, false, false);
|
|
388
|
-
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, true, false, false, false, false);
|
|
389
|
-
|
|
390
|
-
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false, false, true, false, false);
|
|
391
|
-
const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', false, false, false, true, false, false, true, false, false);
|
|
392
|
-
const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false, false, true, false, false);
|
|
393
|
-
|
|
394
|
-
const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false, false, false, true, true);
|
|
395
|
-
const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, false, false, false, true, true);
|
|
396
|
-
const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, false, false, false, true, true);
|
|
397
|
-
const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, false, false, false, false, true, true);
|
|
398
|
-
|
|
399
|
-
const valuation = new TransactionType('V', 'Valuation', 'Valuation', false, false, false, false, false, false, false, false, false);
|
|
400
|
-
const income = new TransactionType('I', 'Income', 'Income', false, false, true, false, false, false, false, false, false);
|
|
394
|
+
const buy = new TransactionType('B', 'Buy', 'Buy', 0, true, false, false, true, false, false, false, true, true);
|
|
395
|
+
const sell = new TransactionType('S', 'Sell', 'Sell', 0, false, true, false, false, true, false, false, false, true);
|
|
396
|
+
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', 0, true, false, false, false, true, false, false, false, true);
|
|
397
|
+
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', 0, false, true, false, true, false, false, false, true, true);
|
|
398
|
+
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', 0, false, false, true, false, false, false, true, false, false);
|
|
399
|
+
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', 1, false, false, false, true, false, false, true, false, false);
|
|
400
|
+
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', 1, false, false, false, true, false, false, true, false, false);
|
|
401
|
+
const split = new TransactionType('SP', 'Split', 'Split', 2, false, false, false, true, false, false, true, false, false);
|
|
402
|
+
const fee = new TransactionType('F', 'Fee', 'Fee', 0, false, false, false, false, false, true, false, false, false);
|
|
403
|
+
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', 0, false, false, false, false, true, false, false, false, false);
|
|
404
|
+
|
|
405
|
+
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', 1, false, false, true, false, false, false, true, false, false);
|
|
406
|
+
const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', 1, false, false, false, true, false, false, true, false, false);
|
|
407
|
+
const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', 1, false, false, false, true, false, false, true, false, false);
|
|
408
|
+
|
|
409
|
+
const deposit = new TransactionType('D', 'Deposit', 'Deposit', 0, false, false, false, false, false, false, false, true, true);
|
|
410
|
+
const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', 0, false, false, false, false, false, false, false, true, true);
|
|
411
|
+
const debit = new TransactionType('DR', 'Debit', 'Debit', 0, false, false, false, false, false, false, false, true, true);
|
|
412
|
+
const credit = new TransactionType('CR', 'Credit', 'Credit', 0, false, false, false, false, false, false, false, true, true);
|
|
413
|
+
|
|
414
|
+
const valuation = new TransactionType('V', 'Valuation', 'Valuation', 0, false, false, false, false, false, false, false, false, false);
|
|
415
|
+
const income = new TransactionType('I', 'Income', 'Income', 0, false, false, true, false, false, false, false, false, false);
|
|
401
416
|
|
|
402
417
|
return TransactionType;
|
|
403
418
|
})();
|
|
@@ -146,13 +146,18 @@ module.exports = (() => {
|
|
|
146
146
|
});
|
|
147
147
|
|
|
148
148
|
formatters.set(TransactionType.DIVIDEND_STOCK, (t) => {
|
|
149
|
-
const
|
|
150
|
-
|
|
151
|
-
return {
|
|
149
|
+
const data = {
|
|
152
150
|
boughtSold: t.quantity,
|
|
153
|
-
|
|
154
|
-
rate: rate
|
|
151
|
+
fee: t.fee
|
|
155
152
|
};
|
|
153
|
+
|
|
154
|
+
if (t.dividend && t.dividend.rate && t.dividend.price) {
|
|
155
|
+
data.shares = t.snapshot.open.subtract(t.quantity);
|
|
156
|
+
data.price = t.dividend.price;
|
|
157
|
+
data.rate = t.dividend.rate;
|
|
158
|
+
}
|
|
159
|
+
|
|
160
|
+
return data;
|
|
156
161
|
});
|
|
157
162
|
|
|
158
163
|
formatters.set(TransactionType.DIVIDEND_REINVEST, (t) => {
|
|
@@ -174,10 +179,18 @@ module.exports = (() => {
|
|
|
174
179
|
});
|
|
175
180
|
|
|
176
181
|
formatters.set(TransactionType.DISTRIBUTION_FUND, (t) => {
|
|
177
|
-
|
|
178
|
-
|
|
182
|
+
const data = {
|
|
183
|
+
boughtSold: t.quantity,
|
|
179
184
|
fee: t.fee
|
|
180
185
|
};
|
|
186
|
+
|
|
187
|
+
if (t.dividend && t.dividend.rate && t.dividend.price) {
|
|
188
|
+
data.shares = t.snapshot.open.subtract(t.quantity);
|
|
189
|
+
data.price = t.dividend.price;
|
|
190
|
+
data.rate = t.dividend.rate;
|
|
191
|
+
}
|
|
192
|
+
|
|
193
|
+
return data;
|
|
181
194
|
});
|
|
182
195
|
|
|
183
196
|
formatters.set(TransactionType.DISTRIBUTION_REINVEST, (t) => {
|
|
@@ -204,7 +217,6 @@ module.exports = (() => {
|
|
|
204
217
|
|
|
205
218
|
formatters.set(TransactionType.FEE_UNITS, (t) => {
|
|
206
219
|
return {
|
|
207
|
-
total: t.charge.amount,
|
|
208
220
|
boughtSold: t.quantity
|
|
209
221
|
};
|
|
210
222
|
});
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -193,7 +193,7 @@ module.exports = (() => {
|
|
|
193
193
|
} else if (code === 5 || code == 15) {
|
|
194
194
|
return InstrumentType.FUND;
|
|
195
195
|
} else {
|
|
196
|
-
throw new Error(
|
|
196
|
+
throw new Error(`Unable to determine InstrumentType for [ ${code} ]`);
|
|
197
197
|
}
|
|
198
198
|
}
|
|
199
199
|
|
|
@@ -635,6 +635,7 @@ module.exports = (() => {
|
|
|
635
635
|
* @param {String} code
|
|
636
636
|
* @param {String} description
|
|
637
637
|
* @param {String} display
|
|
638
|
+
* @param {Number} sequence
|
|
638
639
|
* @param {Boolean} purchase
|
|
639
640
|
* @param {Boolean} sale
|
|
640
641
|
* @param {Boolean} income
|
|
@@ -644,12 +645,14 @@ module.exports = (() => {
|
|
|
644
645
|
* @param {Boolean} corporateAction
|
|
645
646
|
* @param {Boolean} initial
|
|
646
647
|
* @param {Boolean} significant
|
|
647
|
-
|
|
648
|
+
* @param {Boolean} eod
|
|
649
|
+
*/
|
|
648
650
|
class TransactionType extends Enum {
|
|
649
|
-
constructor(code, description, display, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant) {
|
|
651
|
+
constructor(code, description, display, sequence, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant) {
|
|
650
652
|
super(code, description);
|
|
651
653
|
|
|
652
654
|
assert.argumentIsRequired(display, 'display', String);
|
|
655
|
+
assert.argumentIsRequired(sequence, 'sequence', Number);
|
|
653
656
|
assert.argumentIsRequired(purchase, 'purchase', Boolean);
|
|
654
657
|
assert.argumentIsRequired(sale, 'sale', Boolean);
|
|
655
658
|
assert.argumentIsRequired(income, 'income', Boolean);
|
|
@@ -661,6 +664,7 @@ module.exports = (() => {
|
|
|
661
664
|
assert.argumentIsRequired(significant, 'significant', Boolean);
|
|
662
665
|
|
|
663
666
|
this._display = display;
|
|
667
|
+
this._sequence = sequence;
|
|
664
668
|
this._purchase = purchase;
|
|
665
669
|
this._sale = sale;
|
|
666
670
|
this._income = income;
|
|
@@ -682,6 +686,17 @@ module.exports = (() => {
|
|
|
682
686
|
return this._display;
|
|
683
687
|
}
|
|
684
688
|
|
|
689
|
+
/**
|
|
690
|
+
* Specifies ordering when multiple transactions occur on the same day, for
|
|
691
|
+
* the same position.
|
|
692
|
+
*
|
|
693
|
+
* @public
|
|
694
|
+
* @returns {Number}
|
|
695
|
+
*/
|
|
696
|
+
get sequence() {
|
|
697
|
+
return this._sequence;
|
|
698
|
+
}
|
|
699
|
+
|
|
685
700
|
/**
|
|
686
701
|
* Indicates if the transaction was a trade.
|
|
687
702
|
*
|
|
@@ -999,28 +1014,28 @@ module.exports = (() => {
|
|
|
999
1014
|
}
|
|
1000
1015
|
}
|
|
1001
1016
|
|
|
1002
|
-
const buy = new TransactionType('B', 'Buy', 'Buy', true, false, false, true, false, false, false, true, true);
|
|
1003
|
-
const sell = new TransactionType('S', 'Sell', 'Sell', false, true, false, false, true, false, false, false, true);
|
|
1004
|
-
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', true, false, false, false, true, false, false, false, true);
|
|
1005
|
-
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', false, true, false, true, false, false, false, true, true);
|
|
1006
|
-
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', false, false, true, false, false, false, true, false, false);
|
|
1007
|
-
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', false, false, false, true, false, false, true, false, false);
|
|
1008
|
-
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', false, false, false, true, false, false, true, false, false);
|
|
1009
|
-
const split = new TransactionType('SP', 'Split', 'Split', false, false, false, true, false, false, true, false, false);
|
|
1010
|
-
const fee = new TransactionType('F', 'Fee', 'Fee', false, false, false, false, false, true, false, false, false);
|
|
1011
|
-
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, true, false, false, false, false);
|
|
1012
|
-
|
|
1013
|
-
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false, false, true, false, false);
|
|
1014
|
-
const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', false, false, false, true, false, false, true, false, false);
|
|
1015
|
-
const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false, false, true, false, false);
|
|
1016
|
-
|
|
1017
|
-
const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false, false, false, true, true);
|
|
1018
|
-
const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, false, false, false, true, true);
|
|
1019
|
-
const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, false, false, false, true, true);
|
|
1020
|
-
const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, false, false, false, false, true, true);
|
|
1021
|
-
|
|
1022
|
-
const valuation = new TransactionType('V', 'Valuation', 'Valuation', false, false, false, false, false, false, false, false, false);
|
|
1023
|
-
const income = new TransactionType('I', 'Income', 'Income', false, false, true, false, false, false, false, false, false);
|
|
1017
|
+
const buy = new TransactionType('B', 'Buy', 'Buy', 0, true, false, false, true, false, false, false, true, true);
|
|
1018
|
+
const sell = new TransactionType('S', 'Sell', 'Sell', 0, false, true, false, false, true, false, false, false, true);
|
|
1019
|
+
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', 0, true, false, false, false, true, false, false, false, true);
|
|
1020
|
+
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', 0, false, true, false, true, false, false, false, true, true);
|
|
1021
|
+
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', 0, false, false, true, false, false, false, true, false, false);
|
|
1022
|
+
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', 1, false, false, false, true, false, false, true, false, false);
|
|
1023
|
+
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', 1, false, false, false, true, false, false, true, false, false);
|
|
1024
|
+
const split = new TransactionType('SP', 'Split', 'Split', 2, false, false, false, true, false, false, true, false, false);
|
|
1025
|
+
const fee = new TransactionType('F', 'Fee', 'Fee', 0, false, false, false, false, false, true, false, false, false);
|
|
1026
|
+
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', 0, false, false, false, false, true, false, false, false, false);
|
|
1027
|
+
|
|
1028
|
+
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', 1, false, false, true, false, false, false, true, false, false);
|
|
1029
|
+
const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', 1, false, false, false, true, false, false, true, false, false);
|
|
1030
|
+
const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', 1, false, false, false, true, false, false, true, false, false);
|
|
1031
|
+
|
|
1032
|
+
const deposit = new TransactionType('D', 'Deposit', 'Deposit', 0, false, false, false, false, false, false, false, true, true);
|
|
1033
|
+
const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', 0, false, false, false, false, false, false, false, true, true);
|
|
1034
|
+
const debit = new TransactionType('DR', 'Debit', 'Debit', 0, false, false, false, false, false, false, false, true, true);
|
|
1035
|
+
const credit = new TransactionType('CR', 'Credit', 'Credit', 0, false, false, false, false, false, false, false, true, true);
|
|
1036
|
+
|
|
1037
|
+
const valuation = new TransactionType('V', 'Valuation', 'Valuation', 0, false, false, false, false, false, false, false, false, false);
|
|
1038
|
+
const income = new TransactionType('I', 'Income', 'Income', 0, false, false, true, false, false, false, false, false, false);
|
|
1024
1039
|
|
|
1025
1040
|
return TransactionType;
|
|
1026
1041
|
})();
|
|
@@ -5134,8 +5149,8 @@ module.exports = function () {
|
|
|
5134
5149
|
* Compares two strings (in ascending order), using {@link String#localeCompare}.
|
|
5135
5150
|
*
|
|
5136
5151
|
* @static
|
|
5137
|
-
* @param {
|
|
5138
|
-
* @param {
|
|
5152
|
+
* @param {Number} a
|
|
5153
|
+
* @param {Number} b
|
|
5139
5154
|
* @returns {Number}
|
|
5140
5155
|
*/
|
|
5141
5156
|
compareStrings: function compareStrings(a, b) {
|
|
@@ -5825,7 +5840,7 @@ module.exports = function () {
|
|
|
5825
5840
|
* @returns {String}
|
|
5826
5841
|
*/
|
|
5827
5842
|
value: function format() {
|
|
5828
|
-
return
|
|
5843
|
+
return this._year + '-' + leftPad(this._month) + '-' + leftPad(this._day);
|
|
5829
5844
|
}
|
|
5830
5845
|
|
|
5831
5846
|
/**
|
|
@@ -5942,7 +5957,7 @@ module.exports = function () {
|
|
|
5942
5957
|
*
|
|
5943
5958
|
* @static
|
|
5944
5959
|
* @public
|
|
5945
|
-
* @
|
|
5960
|
+
* @return {Day}
|
|
5946
5961
|
*/
|
|
5947
5962
|
|
|
5948
5963
|
}, {
|
|
@@ -6034,11 +6049,8 @@ module.exports = function () {
|
|
|
6034
6049
|
|
|
6035
6050
|
var dayRegex = /^([0-9]{4}).?([0-9]{2}).?([0-9]{2})$/;
|
|
6036
6051
|
|
|
6037
|
-
function leftPad(value
|
|
6038
|
-
|
|
6039
|
-
var padding = digits - string.length;
|
|
6040
|
-
|
|
6041
|
-
return '' + character.repeat(padding) + string;
|
|
6052
|
+
function leftPad(value) {
|
|
6053
|
+
return value < 10 ? '0' + value : '' + value;
|
|
6042
6054
|
}
|
|
6043
6055
|
|
|
6044
6056
|
var comparator = ComparatorBuilder.startWith(function (a, b) {
|
|
@@ -6393,7 +6405,7 @@ module.exports = function () {
|
|
|
6393
6405
|
*
|
|
6394
6406
|
* @public
|
|
6395
6407
|
* @param {Decimal} instance
|
|
6396
|
-
* @
|
|
6408
|
+
* @return {Boolean}
|
|
6397
6409
|
*/
|
|
6398
6410
|
value: function getIsZero(instance) {
|
|
6399
6411
|
assert.argumentIsRequired(instance, 'instance', Decimal, 'Decimal');
|
|
@@ -6406,7 +6418,7 @@ module.exports = function () {
|
|
|
6406
6418
|
*
|
|
6407
6419
|
* @public
|
|
6408
6420
|
* @param {Decimal} instance
|
|
6409
|
-
* @
|
|
6421
|
+
* @return {Boolean}
|
|
6410
6422
|
*/
|
|
6411
6423
|
|
|
6412
6424
|
}, {
|
|
@@ -6422,7 +6434,7 @@ module.exports = function () {
|
|
|
6422
6434
|
*
|
|
6423
6435
|
* @public
|
|
6424
6436
|
* @param {Decimal} instance
|
|
6425
|
-
* @
|
|
6437
|
+
* @return {Boolean}
|
|
6426
6438
|
*/
|
|
6427
6439
|
|
|
6428
6440
|
}, {
|
|
@@ -6438,7 +6450,7 @@ module.exports = function () {
|
|
|
6438
6450
|
*
|
|
6439
6451
|
* @public
|
|
6440
6452
|
* @param {Decimal} instance
|
|
6441
|
-
* @
|
|
6453
|
+
* @return {Boolean}
|
|
6442
6454
|
*/
|
|
6443
6455
|
|
|
6444
6456
|
}, {
|
|
@@ -6454,7 +6466,7 @@ module.exports = function () {
|
|
|
6454
6466
|
*
|
|
6455
6467
|
* @public
|
|
6456
6468
|
* @param {Decimal} instance
|
|
6457
|
-
* @
|
|
6469
|
+
* @return {Boolean}
|
|
6458
6470
|
*/
|
|
6459
6471
|
|
|
6460
6472
|
}, {
|
|
@@ -6470,7 +6482,7 @@ module.exports = function () {
|
|
|
6470
6482
|
*
|
|
6471
6483
|
* @public
|
|
6472
6484
|
* @param {Decimal} instance
|
|
6473
|
-
* @
|
|
6485
|
+
* @return {Boolean}
|
|
6474
6486
|
*/
|
|
6475
6487
|
|
|
6476
6488
|
}, {
|
|
@@ -6860,7 +6872,6 @@ module.exports = function () {
|
|
|
6860
6872
|
/**
|
|
6861
6873
|
* The unique code.
|
|
6862
6874
|
*
|
|
6863
|
-
* @public
|
|
6864
6875
|
* @returns {String}
|
|
6865
6876
|
*/
|
|
6866
6877
|
|
|
@@ -6873,7 +6884,6 @@ module.exports = function () {
|
|
|
6873
6884
|
* Returns true if the provided {@link Enum} argument is equal
|
|
6874
6885
|
* to the instance.
|
|
6875
6886
|
*
|
|
6876
|
-
* @public
|
|
6877
6887
|
* @param {Enum} other
|
|
6878
6888
|
* @returns {boolean}
|
|
6879
6889
|
*/
|
|
@@ -6898,7 +6908,6 @@ module.exports = function () {
|
|
|
6898
6908
|
* Looks up a enumeration item; given the enumeration type and the enumeration
|
|
6899
6909
|
* item's value. If no matching item can be found, a null value is returned.
|
|
6900
6910
|
*
|
|
6901
|
-
* @public
|
|
6902
6911
|
* @param {Function} type - The enumeration type.
|
|
6903
6912
|
* @param {String} code - The enumeration item's code.
|
|
6904
6913
|
* @returns {*|null}
|
|
@@ -6918,7 +6927,6 @@ module.exports = function () {
|
|
|
6918
6927
|
/**
|
|
6919
6928
|
* The description.
|
|
6920
6929
|
*
|
|
6921
|
-
* @public
|
|
6922
6930
|
* @returns {String}
|
|
6923
6931
|
*/
|
|
6924
6932
|
|
|
@@ -6938,7 +6946,6 @@ module.exports = function () {
|
|
|
6938
6946
|
/**
|
|
6939
6947
|
* Returns all of the enumeration's items (given an enumeration type).
|
|
6940
6948
|
*
|
|
6941
|
-
* @public
|
|
6942
6949
|
* @param {Function} type - The enumeration to list.
|
|
6943
6950
|
* @returns {Array}
|
|
6944
6951
|
*/
|
|
@@ -7396,7 +7403,7 @@ module.exports = function () {
|
|
|
7396
7403
|
* Parses the value emitted by {@link Timestamp#toJSON}.
|
|
7397
7404
|
*
|
|
7398
7405
|
* @public
|
|
7399
|
-
* @param {
|
|
7406
|
+
* @param {String} value
|
|
7400
7407
|
* @returns {Timestamp}
|
|
7401
7408
|
*/
|
|
7402
7409
|
|
|
@@ -8032,7 +8039,7 @@ module.exports = function () {
|
|
|
8032
8039
|
|
|
8033
8040
|
if (typeof itemConstraint === 'function' && itemConstraint !== Function) {
|
|
8034
8041
|
itemValidator = function itemValidator(value, index) {
|
|
8035
|
-
return
|
|
8042
|
+
return value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
|
|
8036
8043
|
};
|
|
8037
8044
|
} else {
|
|
8038
8045
|
itemValidator = function itemValidator(value, index) {
|
|
@@ -8142,7 +8149,7 @@ module.exports = function () {
|
|
|
8142
8149
|
*
|
|
8143
8150
|
* @static
|
|
8144
8151
|
* @param {Object} target - The object to check for existence of the property.
|
|
8145
|
-
* @param {String|Array
|
|
8152
|
+
* @param {String|Array<String>} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
|
|
8146
8153
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8147
8154
|
* @returns {boolean}
|
|
8148
8155
|
*/
|
|
@@ -8168,7 +8175,7 @@ module.exports = function () {
|
|
|
8168
8175
|
*
|
|
8169
8176
|
* @static
|
|
8170
8177
|
* @param {Object} target - The object to read from.
|
|
8171
|
-
* @param {String|Array
|
|
8178
|
+
* @param {String|Array<String>} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
|
|
8172
8179
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8173
8180
|
* @returns {*}
|
|
8174
8181
|
*/
|
|
@@ -8203,8 +8210,7 @@ module.exports = function () {
|
|
|
8203
8210
|
*
|
|
8204
8211
|
* @static
|
|
8205
8212
|
* @param {Object} target - The object to write to.
|
|
8206
|
-
* @param {String|Array
|
|
8207
|
-
* @param {*} value - The value to assign.
|
|
8213
|
+
* @param {String|Array<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
|
|
8208
8214
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8209
8215
|
*/
|
|
8210
8216
|
write: function write(target, propertyNames, value, separator) {
|
|
@@ -8230,7 +8236,7 @@ module.exports = function () {
|
|
|
8230
8236
|
*
|
|
8231
8237
|
* @static
|
|
8232
8238
|
* @param {Object} target - The object to erase a property from.
|
|
8233
|
-
* @param {String|Array
|
|
8239
|
+
* @param {String|Array<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
|
|
8234
8240
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8235
8241
|
*/
|
|
8236
8242
|
erase: function erase(target, propertyNames, separator) {
|
|
@@ -9483,7 +9489,7 @@ module.exports = function () {
|
|
|
9483
9489
|
}
|
|
9484
9490
|
|
|
9485
9491
|
/**
|
|
9486
|
-
* Generates a function suitable for use by
|
|
9492
|
+
* Generates a function suitable for use by JSON.parse.
|
|
9487
9493
|
*
|
|
9488
9494
|
* @public
|
|
9489
9495
|
* @returns {Function}
|
|
@@ -13608,9 +13614,9 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
13608
13614
|
|
|
13609
13615
|
mom = createUTC([2000, 1]).day(i);
|
|
13610
13616
|
if (strict && !this._fullWeekdaysParse[i]) {
|
|
13611
|
-
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '
|
|
13612
|
-
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '
|
|
13613
|
-
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '
|
|
13617
|
+
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
|
|
13618
|
+
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
|
|
13619
|
+
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
|
|
13614
13620
|
}
|
|
13615
13621
|
if (!this._weekdaysParse[i]) {
|
|
13616
13622
|
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
|
|
@@ -14413,7 +14419,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
14413
14419
|
|
|
14414
14420
|
function preprocessRFC2822(s) {
|
|
14415
14421
|
// Remove comments and folding whitespace and replace multiple-spaces with a single space
|
|
14416
|
-
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').
|
|
14422
|
+
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim();
|
|
14417
14423
|
}
|
|
14418
14424
|
|
|
14419
14425
|
function checkWeekday(weekdayStr, parsedInput, config) {
|
|
@@ -16592,7 +16598,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16592
16598
|
// Side effect imports
|
|
16593
16599
|
|
|
16594
16600
|
|
|
16595
|
-
hooks.version = '2.22.
|
|
16601
|
+
hooks.version = '2.22.1';
|
|
16596
16602
|
|
|
16597
16603
|
setHookCallback(createLocal);
|
|
16598
16604
|
|