@barchart/portfolio-api-common 1.2.47 → 1.2.51
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
|
|
|
@@ -21,9 +21,10 @@ module.exports = (() => {
|
|
|
21
21
|
* @param {Boolean} corporateAction
|
|
22
22
|
* @param {Boolean} initial
|
|
23
23
|
* @param {Boolean} significant
|
|
24
|
-
|
|
24
|
+
* @param {Boolean} forceZero
|
|
25
|
+
*/
|
|
25
26
|
class TransactionType extends Enum {
|
|
26
|
-
constructor(code, description, display, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant) {
|
|
27
|
+
constructor(code, description, display, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant, forceZero) {
|
|
27
28
|
super(code, description);
|
|
28
29
|
|
|
29
30
|
assert.argumentIsRequired(display, 'display', String);
|
|
@@ -36,6 +37,7 @@ module.exports = (() => {
|
|
|
36
37
|
assert.argumentIsRequired(corporateAction, 'corporateAction', Boolean);
|
|
37
38
|
assert.argumentIsRequired(initial, 'initial', Boolean);
|
|
38
39
|
assert.argumentIsRequired(significant, 'significant', Boolean);
|
|
40
|
+
assert.argumentIsRequired(forceZero, 'forceZero', Boolean);
|
|
39
41
|
|
|
40
42
|
this._display = display;
|
|
41
43
|
this._purchase = purchase;
|
|
@@ -47,6 +49,7 @@ module.exports = (() => {
|
|
|
47
49
|
this._corporateAction = corporateAction;
|
|
48
50
|
this._initial = initial;
|
|
49
51
|
this._significant = significant;
|
|
52
|
+
this._forceZero = forceZero;
|
|
50
53
|
}
|
|
51
54
|
|
|
52
55
|
/**
|
|
@@ -162,6 +165,17 @@ module.exports = (() => {
|
|
|
162
165
|
return this._significant;
|
|
163
166
|
}
|
|
164
167
|
|
|
168
|
+
/**
|
|
169
|
+
* Indicates if closing transaction quantities should be adjusted to zero out
|
|
170
|
+
* the position, when they reach a threshold that approximates zero.
|
|
171
|
+
*
|
|
172
|
+
* @public
|
|
173
|
+
* @returns {Boolean}
|
|
174
|
+
*/
|
|
175
|
+
get forceZero() {
|
|
176
|
+
return this._forceZero;
|
|
177
|
+
}
|
|
178
|
+
|
|
165
179
|
/**
|
|
166
180
|
* A purchase.
|
|
167
181
|
*
|
|
@@ -376,28 +390,28 @@ module.exports = (() => {
|
|
|
376
390
|
}
|
|
377
391
|
}
|
|
378
392
|
|
|
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);
|
|
393
|
+
const buy = new TransactionType('B', 'Buy', 'Buy', true, false, false, true, false, false, false, true, true, false);
|
|
394
|
+
const sell = new TransactionType('S', 'Sell', 'Sell', false, true, false, false, true, false, false, false, true, true);
|
|
395
|
+
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', true, false, false, false, true, false, false, false, true, true);
|
|
396
|
+
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', false, true, false, true, false, false, false, true, true, false);
|
|
397
|
+
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', false, false, true, false, false, false, true, false, false, false);
|
|
398
|
+
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', false, false, false, true, false, false, true, false, false, false);
|
|
399
|
+
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', false, false, false, true, false, false, true, false, false, false);
|
|
400
|
+
const split = new TransactionType('SP', 'Split', 'Split', false, false, false, true, false, false, true, false, false, false);
|
|
401
|
+
const fee = new TransactionType('F', 'Fee', 'Fee', false, false, false, false, false, true, false, false, false, false);
|
|
402
|
+
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, true, false, false, false, false, false);
|
|
403
|
+
|
|
404
|
+
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false, false, true, false, false, false);
|
|
405
|
+
const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', false, false, false, true, false, false, true, false, false, false);
|
|
406
|
+
const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false, false, true, false, false, false);
|
|
407
|
+
|
|
408
|
+
const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false, false, false, true, true, true);
|
|
409
|
+
const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, false, false, false, true, true, true);
|
|
410
|
+
const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, false, false, false, true, true, false);
|
|
411
|
+
const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, false, false, false, false, true, true, false);
|
|
412
|
+
|
|
413
|
+
const valuation = new TransactionType('V', 'Valuation', 'Valuation', false, false, false, false, false, false, false, false, false, false);
|
|
414
|
+
const income = new TransactionType('I', 'Income', 'Income', false, false, true, false, false, false, false, false, false, false);
|
|
401
415
|
|
|
402
416
|
return TransactionType;
|
|
403
417
|
})();
|
|
@@ -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,24 +179,26 @@ 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) => {
|
|
184
197
|
return {
|
|
185
|
-
<<<<<<< HEAD
|
|
186
|
-
shares: t.quantity,
|
|
187
|
-
fee: t.fee
|
|
188
|
-
=======
|
|
189
|
-
boughtSold: t.quantity,
|
|
190
198
|
shares: t.snapshot.open.subtract(t.quantity),
|
|
191
199
|
price: t.dividend.price,
|
|
192
200
|
fee: t.fee,
|
|
193
201
|
rate: t.dividend.rate
|
|
194
|
-
>>>>>>> ec3861f5eeab5fdbfa9275d5ef3f5b988b90999b
|
|
195
202
|
};
|
|
196
203
|
});
|
|
197
204
|
|
|
@@ -210,7 +217,6 @@ module.exports = (() => {
|
|
|
210
217
|
|
|
211
218
|
formatters.set(TransactionType.FEE_UNITS, (t) => {
|
|
212
219
|
return {
|
|
213
|
-
total: t.charge.amount,
|
|
214
220
|
boughtSold: t.quantity
|
|
215
221
|
};
|
|
216
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
|
|
|
@@ -644,9 +644,10 @@ module.exports = (() => {
|
|
|
644
644
|
* @param {Boolean} corporateAction
|
|
645
645
|
* @param {Boolean} initial
|
|
646
646
|
* @param {Boolean} significant
|
|
647
|
-
|
|
647
|
+
* @param {Boolean} forceZero
|
|
648
|
+
*/
|
|
648
649
|
class TransactionType extends Enum {
|
|
649
|
-
constructor(code, description, display, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant) {
|
|
650
|
+
constructor(code, description, display, purchase, sale, income, opening, closing, fee, corporateAction, initial, significant, forceZero) {
|
|
650
651
|
super(code, description);
|
|
651
652
|
|
|
652
653
|
assert.argumentIsRequired(display, 'display', String);
|
|
@@ -659,6 +660,7 @@ module.exports = (() => {
|
|
|
659
660
|
assert.argumentIsRequired(corporateAction, 'corporateAction', Boolean);
|
|
660
661
|
assert.argumentIsRequired(initial, 'initial', Boolean);
|
|
661
662
|
assert.argumentIsRequired(significant, 'significant', Boolean);
|
|
663
|
+
assert.argumentIsRequired(forceZero, 'forceZero', Boolean);
|
|
662
664
|
|
|
663
665
|
this._display = display;
|
|
664
666
|
this._purchase = purchase;
|
|
@@ -670,6 +672,7 @@ module.exports = (() => {
|
|
|
670
672
|
this._corporateAction = corporateAction;
|
|
671
673
|
this._initial = initial;
|
|
672
674
|
this._significant = significant;
|
|
675
|
+
this._forceZero = forceZero;
|
|
673
676
|
}
|
|
674
677
|
|
|
675
678
|
/**
|
|
@@ -785,6 +788,17 @@ module.exports = (() => {
|
|
|
785
788
|
return this._significant;
|
|
786
789
|
}
|
|
787
790
|
|
|
791
|
+
/**
|
|
792
|
+
* Indicates if closing transaction quantities should be adjusted to zero out
|
|
793
|
+
* the position, when they reach a threshold that approximates zero.
|
|
794
|
+
*
|
|
795
|
+
* @public
|
|
796
|
+
* @returns {Boolean}
|
|
797
|
+
*/
|
|
798
|
+
get forceZero() {
|
|
799
|
+
return this._forceZero;
|
|
800
|
+
}
|
|
801
|
+
|
|
788
802
|
/**
|
|
789
803
|
* A purchase.
|
|
790
804
|
*
|
|
@@ -999,28 +1013,28 @@ module.exports = (() => {
|
|
|
999
1013
|
}
|
|
1000
1014
|
}
|
|
1001
1015
|
|
|
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);
|
|
1016
|
+
const buy = new TransactionType('B', 'Buy', 'Buy', true, false, false, true, false, false, false, true, true, false);
|
|
1017
|
+
const sell = new TransactionType('S', 'Sell', 'Sell', false, true, false, false, true, false, false, false, true, true);
|
|
1018
|
+
const buyShort = new TransactionType('BS', 'Buy To Cover', 'Buy To Cover', true, false, false, false, true, false, false, false, true, true);
|
|
1019
|
+
const sellShort = new TransactionType('SS', 'Sell Short', 'Sell Short', false, true, false, true, false, false, false, true, true, false);
|
|
1020
|
+
const dividend = new TransactionType('DV', 'Dividend', 'Dividend', false, false, true, false, false, false, true, false, false, false);
|
|
1021
|
+
const dividendReinvest = new TransactionType('DX', 'Dividend (Reinvested)', 'Dividend Reinvest', false, false, false, true, false, false, true, false, false, false);
|
|
1022
|
+
const dividendStock = new TransactionType('DS', 'Dividend (Stock)', 'Dividend Stock', false, false, false, true, false, false, true, false, false, false);
|
|
1023
|
+
const split = new TransactionType('SP', 'Split', 'Split', false, false, false, true, false, false, true, false, false, false);
|
|
1024
|
+
const fee = new TransactionType('F', 'Fee', 'Fee', false, false, false, false, false, true, false, false, false, false);
|
|
1025
|
+
const feeUnits = new TransactionType('FU', 'Fee Units', 'Fee', false, false, false, false, true, false, false, false, false, false);
|
|
1026
|
+
|
|
1027
|
+
const distributionCash = new TransactionType('DC', 'Distribution (Cash)', 'Cash Distribution', false, false, true, false, false, false, true, false, false, false);
|
|
1028
|
+
const distributionReinvest = new TransactionType('DY', 'Distribution (Reinvested)', 'Distribution Reinvest', false, false, false, true, false, false, true, false, false, false);
|
|
1029
|
+
const distributionFund = new TransactionType('DF', 'Distribution (Units)', 'Unit Distribution', false, false, false, true, false, false, true, false, false, false);
|
|
1030
|
+
|
|
1031
|
+
const deposit = new TransactionType('D', 'Deposit', 'Deposit', false, false, false, false, false, false, false, true, true, true);
|
|
1032
|
+
const withdrawal = new TransactionType('W', 'Withdrawal', 'Withdrawal', false, false, false, false, false, false, false, true, true, true);
|
|
1033
|
+
const debit = new TransactionType('DR', 'Debit', 'Debit', false, false, false, false, false, false, false, true, true, false);
|
|
1034
|
+
const credit = new TransactionType('CR', 'Credit', 'Credit', false, false, false, false, false, false, false, true, true, false);
|
|
1035
|
+
|
|
1036
|
+
const valuation = new TransactionType('V', 'Valuation', 'Valuation', false, false, false, false, false, false, false, false, false, false);
|
|
1037
|
+
const income = new TransactionType('I', 'Income', 'Income', false, false, true, false, false, false, false, false, false, false);
|
|
1024
1038
|
|
|
1025
1039
|
return TransactionType;
|
|
1026
1040
|
})();
|
|
@@ -5134,8 +5148,8 @@ module.exports = function () {
|
|
|
5134
5148
|
* Compares two strings (in ascending order), using {@link String#localeCompare}.
|
|
5135
5149
|
*
|
|
5136
5150
|
* @static
|
|
5137
|
-
* @param {
|
|
5138
|
-
* @param {
|
|
5151
|
+
* @param {Number} a
|
|
5152
|
+
* @param {Number} b
|
|
5139
5153
|
* @returns {Number}
|
|
5140
5154
|
*/
|
|
5141
5155
|
compareStrings: function compareStrings(a, b) {
|
|
@@ -5825,7 +5839,7 @@ module.exports = function () {
|
|
|
5825
5839
|
* @returns {String}
|
|
5826
5840
|
*/
|
|
5827
5841
|
value: function format() {
|
|
5828
|
-
return
|
|
5842
|
+
return this._year + '-' + leftPad(this._month) + '-' + leftPad(this._day);
|
|
5829
5843
|
}
|
|
5830
5844
|
|
|
5831
5845
|
/**
|
|
@@ -5942,7 +5956,7 @@ module.exports = function () {
|
|
|
5942
5956
|
*
|
|
5943
5957
|
* @static
|
|
5944
5958
|
* @public
|
|
5945
|
-
* @
|
|
5959
|
+
* @return {Day}
|
|
5946
5960
|
*/
|
|
5947
5961
|
|
|
5948
5962
|
}, {
|
|
@@ -6034,11 +6048,8 @@ module.exports = function () {
|
|
|
6034
6048
|
|
|
6035
6049
|
var dayRegex = /^([0-9]{4}).?([0-9]{2}).?([0-9]{2})$/;
|
|
6036
6050
|
|
|
6037
|
-
function leftPad(value
|
|
6038
|
-
|
|
6039
|
-
var padding = digits - string.length;
|
|
6040
|
-
|
|
6041
|
-
return '' + character.repeat(padding) + string;
|
|
6051
|
+
function leftPad(value) {
|
|
6052
|
+
return value < 10 ? '0' + value : '' + value;
|
|
6042
6053
|
}
|
|
6043
6054
|
|
|
6044
6055
|
var comparator = ComparatorBuilder.startWith(function (a, b) {
|
|
@@ -6393,7 +6404,7 @@ module.exports = function () {
|
|
|
6393
6404
|
*
|
|
6394
6405
|
* @public
|
|
6395
6406
|
* @param {Decimal} instance
|
|
6396
|
-
* @
|
|
6407
|
+
* @return {Boolean}
|
|
6397
6408
|
*/
|
|
6398
6409
|
value: function getIsZero(instance) {
|
|
6399
6410
|
assert.argumentIsRequired(instance, 'instance', Decimal, 'Decimal');
|
|
@@ -6406,7 +6417,7 @@ module.exports = function () {
|
|
|
6406
6417
|
*
|
|
6407
6418
|
* @public
|
|
6408
6419
|
* @param {Decimal} instance
|
|
6409
|
-
* @
|
|
6420
|
+
* @return {Boolean}
|
|
6410
6421
|
*/
|
|
6411
6422
|
|
|
6412
6423
|
}, {
|
|
@@ -6422,7 +6433,7 @@ module.exports = function () {
|
|
|
6422
6433
|
*
|
|
6423
6434
|
* @public
|
|
6424
6435
|
* @param {Decimal} instance
|
|
6425
|
-
* @
|
|
6436
|
+
* @return {Boolean}
|
|
6426
6437
|
*/
|
|
6427
6438
|
|
|
6428
6439
|
}, {
|
|
@@ -6438,7 +6449,7 @@ module.exports = function () {
|
|
|
6438
6449
|
*
|
|
6439
6450
|
* @public
|
|
6440
6451
|
* @param {Decimal} instance
|
|
6441
|
-
* @
|
|
6452
|
+
* @return {Boolean}
|
|
6442
6453
|
*/
|
|
6443
6454
|
|
|
6444
6455
|
}, {
|
|
@@ -6454,7 +6465,7 @@ module.exports = function () {
|
|
|
6454
6465
|
*
|
|
6455
6466
|
* @public
|
|
6456
6467
|
* @param {Decimal} instance
|
|
6457
|
-
* @
|
|
6468
|
+
* @return {Boolean}
|
|
6458
6469
|
*/
|
|
6459
6470
|
|
|
6460
6471
|
}, {
|
|
@@ -6470,7 +6481,7 @@ module.exports = function () {
|
|
|
6470
6481
|
*
|
|
6471
6482
|
* @public
|
|
6472
6483
|
* @param {Decimal} instance
|
|
6473
|
-
* @
|
|
6484
|
+
* @return {Boolean}
|
|
6474
6485
|
*/
|
|
6475
6486
|
|
|
6476
6487
|
}, {
|
|
@@ -6860,7 +6871,6 @@ module.exports = function () {
|
|
|
6860
6871
|
/**
|
|
6861
6872
|
* The unique code.
|
|
6862
6873
|
*
|
|
6863
|
-
* @public
|
|
6864
6874
|
* @returns {String}
|
|
6865
6875
|
*/
|
|
6866
6876
|
|
|
@@ -6873,7 +6883,6 @@ module.exports = function () {
|
|
|
6873
6883
|
* Returns true if the provided {@link Enum} argument is equal
|
|
6874
6884
|
* to the instance.
|
|
6875
6885
|
*
|
|
6876
|
-
* @public
|
|
6877
6886
|
* @param {Enum} other
|
|
6878
6887
|
* @returns {boolean}
|
|
6879
6888
|
*/
|
|
@@ -6898,7 +6907,6 @@ module.exports = function () {
|
|
|
6898
6907
|
* Looks up a enumeration item; given the enumeration type and the enumeration
|
|
6899
6908
|
* item's value. If no matching item can be found, a null value is returned.
|
|
6900
6909
|
*
|
|
6901
|
-
* @public
|
|
6902
6910
|
* @param {Function} type - The enumeration type.
|
|
6903
6911
|
* @param {String} code - The enumeration item's code.
|
|
6904
6912
|
* @returns {*|null}
|
|
@@ -6918,7 +6926,6 @@ module.exports = function () {
|
|
|
6918
6926
|
/**
|
|
6919
6927
|
* The description.
|
|
6920
6928
|
*
|
|
6921
|
-
* @public
|
|
6922
6929
|
* @returns {String}
|
|
6923
6930
|
*/
|
|
6924
6931
|
|
|
@@ -6938,7 +6945,6 @@ module.exports = function () {
|
|
|
6938
6945
|
/**
|
|
6939
6946
|
* Returns all of the enumeration's items (given an enumeration type).
|
|
6940
6947
|
*
|
|
6941
|
-
* @public
|
|
6942
6948
|
* @param {Function} type - The enumeration to list.
|
|
6943
6949
|
* @returns {Array}
|
|
6944
6950
|
*/
|
|
@@ -7396,7 +7402,7 @@ module.exports = function () {
|
|
|
7396
7402
|
* Parses the value emitted by {@link Timestamp#toJSON}.
|
|
7397
7403
|
*
|
|
7398
7404
|
* @public
|
|
7399
|
-
* @param {
|
|
7405
|
+
* @param {String} value
|
|
7400
7406
|
* @returns {Timestamp}
|
|
7401
7407
|
*/
|
|
7402
7408
|
|
|
@@ -8032,7 +8038,7 @@ module.exports = function () {
|
|
|
8032
8038
|
|
|
8033
8039
|
if (typeof itemConstraint === 'function' && itemConstraint !== Function) {
|
|
8034
8040
|
itemValidator = function itemValidator(value, index) {
|
|
8035
|
-
return
|
|
8041
|
+
return value instanceof itemConstraint || itemConstraint(value, variableName + '[' + index + ']');
|
|
8036
8042
|
};
|
|
8037
8043
|
} else {
|
|
8038
8044
|
itemValidator = function itemValidator(value, index) {
|
|
@@ -8142,7 +8148,7 @@ module.exports = function () {
|
|
|
8142
8148
|
*
|
|
8143
8149
|
* @static
|
|
8144
8150
|
* @param {Object} target - The object to check for existence of the property.
|
|
8145
|
-
* @param {String|Array
|
|
8151
|
+
* @param {String|Array<String>} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
|
|
8146
8152
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8147
8153
|
* @returns {boolean}
|
|
8148
8154
|
*/
|
|
@@ -8168,7 +8174,7 @@ module.exports = function () {
|
|
|
8168
8174
|
*
|
|
8169
8175
|
* @static
|
|
8170
8176
|
* @param {Object} target - The object to read from.
|
|
8171
|
-
* @param {String|Array
|
|
8177
|
+
* @param {String|Array<String>} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
|
|
8172
8178
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8173
8179
|
* @returns {*}
|
|
8174
8180
|
*/
|
|
@@ -8203,8 +8209,7 @@ module.exports = function () {
|
|
|
8203
8209
|
*
|
|
8204
8210
|
* @static
|
|
8205
8211
|
* @param {Object} target - The object to write to.
|
|
8206
|
-
* @param {String|Array
|
|
8207
|
-
* @param {*} value - The value to assign.
|
|
8212
|
+
* @param {String|Array<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
|
|
8208
8213
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8209
8214
|
*/
|
|
8210
8215
|
write: function write(target, propertyNames, value, separator) {
|
|
@@ -8230,7 +8235,7 @@ module.exports = function () {
|
|
|
8230
8235
|
*
|
|
8231
8236
|
* @static
|
|
8232
8237
|
* @param {Object} target - The object to erase a property from.
|
|
8233
|
-
* @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).
|
|
8234
8239
|
* @param {String=} separator - The separator (defaults to a period character).
|
|
8235
8240
|
*/
|
|
8236
8241
|
erase: function erase(target, propertyNames, separator) {
|
|
@@ -9483,7 +9488,7 @@ module.exports = function () {
|
|
|
9483
9488
|
}
|
|
9484
9489
|
|
|
9485
9490
|
/**
|
|
9486
|
-
* Generates a function suitable for use by
|
|
9491
|
+
* Generates a function suitable for use by JSON.parse.
|
|
9487
9492
|
*
|
|
9488
9493
|
* @public
|
|
9489
9494
|
* @returns {Function}
|
|
@@ -13608,9 +13613,9 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
13608
13613
|
|
|
13609
13614
|
mom = createUTC([2000, 1]).day(i);
|
|
13610
13615
|
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('.', '
|
|
13616
|
+
this._fullWeekdaysParse[i] = new RegExp('^' + this.weekdays(mom, '').replace('.', '\.?') + '$', 'i');
|
|
13617
|
+
this._shortWeekdaysParse[i] = new RegExp('^' + this.weekdaysShort(mom, '').replace('.', '\.?') + '$', 'i');
|
|
13618
|
+
this._minWeekdaysParse[i] = new RegExp('^' + this.weekdaysMin(mom, '').replace('.', '\.?') + '$', 'i');
|
|
13614
13619
|
}
|
|
13615
13620
|
if (!this._weekdaysParse[i]) {
|
|
13616
13621
|
regex = '^' + this.weekdays(mom, '') + '|^' + this.weekdaysShort(mom, '') + '|^' + this.weekdaysMin(mom, '');
|
|
@@ -14413,7 +14418,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
14413
14418
|
|
|
14414
14419
|
function preprocessRFC2822(s) {
|
|
14415
14420
|
// Remove comments and folding whitespace and replace multiple-spaces with a single space
|
|
14416
|
-
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').
|
|
14421
|
+
return s.replace(/\([^)]*\)|[\n\t]/g, ' ').replace(/(\s\s+)/g, ' ').trim();
|
|
14417
14422
|
}
|
|
14418
14423
|
|
|
14419
14424
|
function checkWeekday(weekdayStr, parsedInput, config) {
|
|
@@ -16592,7 +16597,7 @@ moment.tz.load(require('./data/packed/latest.json'));
|
|
|
16592
16597
|
// Side effect imports
|
|
16593
16598
|
|
|
16594
16599
|
|
|
16595
|
-
hooks.version = '2.22.
|
|
16600
|
+
hooks.version = '2.22.1';
|
|
16596
16601
|
|
|
16597
16602
|
setHookCallback(createLocal);
|
|
16598
16603
|
|