@barchart/portfolio-api-common 1.3.3 → 1.3.4

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.
package/.jshintrc ADDED
@@ -0,0 +1,3 @@
1
+ {
2
+ "validthis": true
3
+ }
@@ -45,7 +45,7 @@ module.exports = (() => {
45
45
  *
46
46
  * @public
47
47
  * @static
48
- * @param {Array.<Object>} transactions
48
+ * @param {Object[]} transactions
49
49
  * @param {Boolean=} strict
50
50
  * @returns {Boolean}
51
51
  */
@@ -59,7 +59,7 @@ module.exports = (() => {
59
59
  *
60
60
  * @public
61
61
  * @static
62
- * @param {Array.<Object>} transactions
62
+ * @param {Object[]} transactions
63
63
  * @returns {Boolean}
64
64
  */
65
65
  static validateReferences(transactions) {
@@ -97,7 +97,7 @@ module.exports = (() => {
97
97
  *
98
98
  * @public
99
99
  * @static
100
- * @param {Array.<Object>} transactions
100
+ * @param {Object[]} transactions
101
101
  * @param {Boolean=} strict
102
102
  * @returns {Number}
103
103
  */
@@ -116,7 +116,7 @@ module.exports = (() => {
116
116
  * @param {InstrumentType} instrumentType
117
117
  * @param {Boolean=} userInitiated
118
118
  * @param {PositionDirection=} currentDirection
119
- * @returns {Array.<TransactionType>}
119
+ * @returns {TransactionType[]}
120
120
  */
121
121
  static getTransactionTypesFor(instrumentType, userInitiated, currentDirection) {
122
122
  assert.argumentIsRequired(instrumentType, 'instrumentType', InstrumentType, 'InstrumentType');
@@ -141,7 +141,7 @@ module.exports = (() => {
141
141
  *
142
142
  * @public
143
143
  * @static
144
- * @returns {Array.<TransactionType>}
144
+ * @returns {TransactionType[]}
145
145
  */
146
146
  static getUserInitiatedTransactionTypes() {
147
147
  return array.unique(Object.keys(validTransactionTypes).reduce((types, key) => {
@@ -28,8 +28,8 @@ module.exports = (() => {
28
28
  *
29
29
  * @public
30
30
  * @static
31
- * @param {Array.<Object>} transactions
32
- * @param {Array.<Object>} positions
31
+ * @param {Object[]} transactions
32
+ * @param {Object[]} positions
33
33
  * @param {Boolean=} descending
34
34
  * @returns {Array}
35
35
  */
@@ -97,7 +97,7 @@ module.exports = (() => {
97
97
  *
98
98
  * @public
99
99
  * @static
100
- * @param {Array.<Object>} transactions
100
+ * @param {Object[]} transactions
101
101
  * @param {Boolean=} descending
102
102
  * @returns {Array}
103
103
  */
@@ -39,10 +39,10 @@ module.exports = (() => {
39
39
  * changes) for each level of grouping.
40
40
  *
41
41
  * @public
42
- * @param {Array.<PositionTreeDefinition>} definitions
43
- * @param {Array.<Object>} portfolios - The portfolios.
44
- * @param {Array.<Object>} positions - The positions (for all of the portfolios).
45
- * @param {Array.<Object>} summaries - The positions summaries (for all of the positions).
42
+ * @param {PositionTreeDefinition[]} definitions
43
+ * @param {Object[]} portfolios - The portfolios.
44
+ * @param {Object[]} positions - The positions (for all of the portfolios).
45
+ * @param {Object[]} summaries - The positions summaries (for all of the positions).
46
46
  * @param {PositionSummaryFrame=} reportFrame - If specified, locks the current (and previous) periods to a specific frame, use for reporting.
47
47
  * @param {Day=} reportDate - The end date for the report frame.
48
48
  */
@@ -172,6 +172,53 @@ module.exports = (() => {
172
172
  recalculatePercentages.call(this);
173
173
  }
174
174
 
175
+ /**
176
+ * Returns Barchart's user identifier for the container's portfolios. If
177
+ * the container has no portfolios, a null value is returned.
178
+ *
179
+ * @public
180
+ * @returns {String|null}
181
+ */
182
+ getBarchartUserId() {
183
+ let returnRef = null;
184
+
185
+ const keys = Object.keys(this._portfolios);
186
+
187
+ if (keys.length > 0) {
188
+ const firstKey = keys[0];
189
+ const firstPortfolio = this._portfolios[firstKey];
190
+
191
+ returnRef = firstPortfolio.user;
192
+ }
193
+
194
+ return returnRef;
195
+ }
196
+
197
+ /**
198
+ * Returns customer's user identifier for the container's portfolios. If
199
+ * the container has no portfolios, or if the portfolio(s) are not owned
200
+ * by a remote customer, a null value is returned.
201
+ *
202
+ * @public
203
+ * @returns {String|null}
204
+ */
205
+ getCustomerUserId() {
206
+ let returnRef = null;
207
+
208
+ const keys = Object.keys(this._portfolios);
209
+
210
+ if (keys.length > 0) {
211
+ const firstKey = keys[0];
212
+ const firstPortfolio = this._portfolios[firstKey];
213
+
214
+ if (firstPortfolio.legacy && firstPortfolio.legacy.user) {
215
+ returnRef = firstPortfolio.legacy.user;
216
+ }
217
+ }
218
+
219
+ return returnRef;
220
+ }
221
+
175
222
  /**
176
223
  * Adds a new portfolio to the container, injecting it into aggregation
177
224
  * trees, as necessary.
@@ -284,7 +331,7 @@ module.exports = (() => {
284
331
  *
285
332
  * @public
286
333
  * @param {Object} position
287
- * @param {Array.<Object>} summaries
334
+ * @param {Object>[]} summaries
288
335
  */
289
336
  updatePosition(position, summaries) {
290
337
  assert.argumentIsRequired(position, 'position', Object);
@@ -387,7 +434,7 @@ module.exports = (() => {
387
434
  *
388
435
  * @public
389
436
  * @param {Boolean} display - If true, all "display" symbols are returned; otherwise Barchart symbols are returned.
390
- * @returns {Array.<String>}
437
+ * @returns {String[]}
391
438
  */
392
439
  getPositionSymbols(display) {
393
440
  const symbols = this._items.reduce((symbols, item) => {
@@ -451,8 +498,8 @@ module.exports = (() => {
451
498
  * triggering updates to position(s) and data aggregation(s).
452
499
  *
453
500
  * @public
454
- * @param {Array.<Object>} positionQuotes
455
- * @param {Array.<Object>} forexQuotes
501
+ * @param {Object[]} positionQuotes
502
+ * @param {Object[]} forexQuotes
456
503
  */
457
504
  setQuotes(positionQuotes, forexQuotes) {
458
505
  assert.argumentIsArray(positionQuotes, 'positionQuotes');
@@ -514,7 +561,7 @@ module.exports = (() => {
514
561
  * Returns all forex symbols that are required to do currency translations.
515
562
  *
516
563
  * @public
517
- * @returns {Array.<String>}
564
+ * @returns {String[]}
518
565
  */
519
566
  getForexSymbols() {
520
567
  return this._forexSymbols;
@@ -524,7 +571,7 @@ module.exports = (() => {
524
571
  * Returns all current forex quotes.
525
572
  *
526
573
  * @public
527
- * @returns {Array.<Object>}
574
+ * @returns {Object[]}
528
575
  */
529
576
  getForexQuotes() {
530
577
  return this._forexQuotes;
@@ -586,7 +633,7 @@ module.exports = (() => {
586
633
  *
587
634
  * @public
588
635
  * @param {String} name
589
- * @param {Array.<String>} keys
636
+ * @param {String[]} keys
590
637
  * @returns {PositionGroup}
591
638
  */
592
639
  getGroup(name, keys) {
@@ -602,8 +649,8 @@ module.exports = (() => {
602
649
  *
603
650
  * @public
604
651
  * @param {String} name
605
- * @param {Array.<String>} keys
606
- * @returns {Array.<PositionGroup>}
652
+ * @param {String[]} keys
653
+ * @returns {PositionGroup[]}
607
654
  */
608
655
  getGroups(name, keys) {
609
656
  assert.argumentIsRequired(name, 'name', String);
@@ -642,7 +689,7 @@ module.exports = (() => {
642
689
  * Returns all portfolios in the container.
643
690
  *
644
691
  * @public
645
- * @returns {Array.<Object>}
692
+ * @returns {Object[]}
646
693
  */
647
694
  getPortfolios() {
648
695
  return Object.keys(this._portfolios).map(id => this._portfolios[id]);
@@ -653,7 +700,7 @@ module.exports = (() => {
653
700
  *
654
701
  * @public
655
702
  * @param {String} portfolio
656
- * @returns {Array.<Object>}
703
+ * @returns {Object[]}
657
704
  */
658
705
  getPositions(portfolio) {
659
706
  assert.argumentIsRequired(portfolio, 'portfolio', String);
@@ -26,7 +26,7 @@ module.exports = (() => {
26
26
  * @public
27
27
  * @param {PositionContainer} container
28
28
  * @param {LevelDefinition} definition
29
- * @param {Array.<PositionItem>} items
29
+ * @param {PositionItem[]} items
30
30
  * @param {Currency} currency
31
31
  * @param {String} key
32
32
  * @param {String} description
@@ -361,7 +361,7 @@ module.exports = (() => {
361
361
  * Sets the list of items which are excluded from group aggregation calculations.
362
362
  *
363
363
  * @public
364
- * @param {Array.<Object>} items
364
+ * @param {Object[]} items
365
365
  */
366
366
  setExcludedItems(items) {
367
367
  this._excludedItems = items;
@@ -382,7 +382,7 @@ module.exports = (() => {
382
382
  * Causes aggregated data to be recalculated using a new exchange rate.
383
383
  *
384
384
  * @public
385
- * @param {Array.<Rate>} rate
385
+ * @param {Rate[]} rates
386
386
  */
387
387
  setForexRates(rates) {
388
388
  this._rates = rates;
@@ -20,7 +20,7 @@ module.exports = (() => {
20
20
  * @param {Object} portfolio
21
21
  * @param {Object} position
22
22
  * @param {Object} currentSummary
23
- * @param {Array.<Object>} previousSummaries
23
+ * @param {Object[]} previousSummaries
24
24
  * @param {Boolean} reporting
25
25
  */
26
26
  class PositionItem extends Disposable {
@@ -19,7 +19,7 @@ module.exports = (() => {
19
19
  * @param {PositionLevelDefinition~keySelector} keySelector
20
20
  * @param {PositionLevelDefinition~descriptionSelector} descriptionSelector
21
21
  * @param {PositionLevelDefinition~currencySelector} currencySelector
22
- * @param {Array.<PositionLevelDefinition~RequiredGroup>=} requiredGroups
22
+ * @param {PositionLevelDefinition~RequiredGroup[]=} requiredGroups
23
23
  * @param {Boolean=} aggregateCash
24
24
  * @param {Function=} requiredGroupGenerator
25
25
  */
@@ -10,8 +10,8 @@ module.exports = (() => {
10
10
  *
11
11
  * @public
12
12
  * @param {String} name
13
- * @param {Array.<PositionLevelDefinition>} definitions
14
- * @oaram {Array.<String>=} exclusionDependencies
13
+ * @param {PositionLevelDefinition[]} definitions
14
+ * @oaram {String[]=} exclusionDependencies
15
15
  */
16
16
  class PositionTreeDefinitions {
17
17
  constructor(name, definitions, exclusionDependencies) {
@@ -44,7 +44,7 @@ module.exports = (() => {
44
44
  * bottom-most level of the tree (i.e. leaf nodes).
45
45
  *
46
46
  * @public
47
- * @returns {Array.<PositionLevelDefinitions>}
47
+ * @returns {PositionLevelDefinitions>[]}
48
48
  */
49
49
  get definitions() {
50
50
  return this._definitions;
@@ -55,7 +55,7 @@ module.exports = (() => {
55
55
  * group (from the current tree) is excluded.
56
56
  *
57
57
  * @public
58
- * @returns {Array.<String>}
58
+ * @returns {String[]}
59
59
  */
60
60
  get exclusionDependencies() {
61
61
  return this._exclusionDependencies;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.3.3",
3
+ "version": "1.3.4",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -21,7 +21,7 @@
21
21
  "glob": "^6.0.1",
22
22
  "gulp": "~3.9.0",
23
23
  "gulp-bump": "~1.0.0",
24
- "gulp-git": "~1.6.0",
24
+ "gulp-git": "^2.5.1",
25
25
  "gulp-jasmine": "^2.2.1",
26
26
  "gulp-jshint": "~2.1.0",
27
27
  "gulp-util": "^3.0.7",
@@ -1232,7 +1232,7 @@ module.exports = (() => {
1232
1232
  *
1233
1233
  * @public
1234
1234
  * @static
1235
- * @param {Array.<Object>} transactions
1235
+ * @param {Object[]} transactions
1236
1236
  * @param {Boolean=} strict
1237
1237
  * @returns {Boolean}
1238
1238
  */
@@ -1246,7 +1246,7 @@ module.exports = (() => {
1246
1246
  *
1247
1247
  * @public
1248
1248
  * @static
1249
- * @param {Array.<Object>} transactions
1249
+ * @param {Object[]} transactions
1250
1250
  * @returns {Boolean}
1251
1251
  */
1252
1252
  static validateReferences(transactions) {
@@ -1284,7 +1284,7 @@ module.exports = (() => {
1284
1284
  *
1285
1285
  * @public
1286
1286
  * @static
1287
- * @param {Array.<Object>} transactions
1287
+ * @param {Object[]} transactions
1288
1288
  * @param {Boolean=} strict
1289
1289
  * @returns {Number}
1290
1290
  */
@@ -1303,7 +1303,7 @@ module.exports = (() => {
1303
1303
  * @param {InstrumentType} instrumentType
1304
1304
  * @param {Boolean=} userInitiated
1305
1305
  * @param {PositionDirection=} currentDirection
1306
- * @returns {Array.<TransactionType>}
1306
+ * @returns {TransactionType[]}
1307
1307
  */
1308
1308
  static getTransactionTypesFor(instrumentType, userInitiated, currentDirection) {
1309
1309
  assert.argumentIsRequired(instrumentType, 'instrumentType', InstrumentType, 'InstrumentType');
@@ -1328,7 +1328,7 @@ module.exports = (() => {
1328
1328
  *
1329
1329
  * @public
1330
1330
  * @static
1331
- * @returns {Array.<TransactionType>}
1331
+ * @returns {TransactionType[]}
1332
1332
  */
1333
1333
  static getUserInitiatedTransactionTypes() {
1334
1334
  return array.unique(Object.keys(validTransactionTypes).reduce((types, key) => {
@@ -1525,10 +1525,10 @@ module.exports = (() => {
1525
1525
  * changes) for each level of grouping.
1526
1526
  *
1527
1527
  * @public
1528
- * @param {Array.<PositionTreeDefinition>} definitions
1529
- * @param {Array.<Object>} portfolios - The portfolios.
1530
- * @param {Array.<Object>} positions - The positions (for all of the portfolios).
1531
- * @param {Array.<Object>} summaries - The positions summaries (for all of the positions).
1528
+ * @param {PositionTreeDefinition[]} definitions
1529
+ * @param {Object[]} portfolios - The portfolios.
1530
+ * @param {Object[]} positions - The positions (for all of the portfolios).
1531
+ * @param {Object[]} summaries - The positions summaries (for all of the positions).
1532
1532
  * @param {PositionSummaryFrame=} reportFrame - If specified, locks the current (and previous) periods to a specific frame, use for reporting.
1533
1533
  * @param {Day=} reportDate - The end date for the report frame.
1534
1534
  */
@@ -1658,6 +1658,53 @@ module.exports = (() => {
1658
1658
  recalculatePercentages.call(this);
1659
1659
  }
1660
1660
 
1661
+ /**
1662
+ * Returns Barchart's user identifier for the container's portfolios. If
1663
+ * the container has no portfolios, a null value is returned.
1664
+ *
1665
+ * @public
1666
+ * @returns {String|null}
1667
+ */
1668
+ getBarchartUserId() {
1669
+ let returnRef = null;
1670
+
1671
+ const keys = Object.keys(this._portfolios);
1672
+
1673
+ if (keys.length > 0) {
1674
+ const firstKey = keys[0];
1675
+ const firstPortfolio = this._portfolios[firstKey];
1676
+
1677
+ returnRef = firstPortfolio.user;
1678
+ }
1679
+
1680
+ return returnRef;
1681
+ }
1682
+
1683
+ /**
1684
+ * Returns customer's user identifier for the container's portfolios. If
1685
+ * the container has no portfolios, or if the portfolio(s) are not owned
1686
+ * by a remote customer, a null value is returned.
1687
+ *
1688
+ * @public
1689
+ * @returns {String|null}
1690
+ */
1691
+ getCustomerUserId() {
1692
+ let returnRef = null;
1693
+
1694
+ const keys = Object.keys(this._portfolios);
1695
+
1696
+ if (keys.length > 0) {
1697
+ const firstKey = keys[0];
1698
+ const firstPortfolio = this._portfolios[firstKey];
1699
+
1700
+ if (firstPortfolio.legacy && firstPortfolio.legacy.user) {
1701
+ returnRef = firstPortfolio.legacy.user;
1702
+ }
1703
+ }
1704
+
1705
+ return returnRef;
1706
+ }
1707
+
1661
1708
  /**
1662
1709
  * Adds a new portfolio to the container, injecting it into aggregation
1663
1710
  * trees, as necessary.
@@ -1770,7 +1817,7 @@ module.exports = (() => {
1770
1817
  *
1771
1818
  * @public
1772
1819
  * @param {Object} position
1773
- * @param {Array.<Object>} summaries
1820
+ * @param {Object>[]} summaries
1774
1821
  */
1775
1822
  updatePosition(position, summaries) {
1776
1823
  assert.argumentIsRequired(position, 'position', Object);
@@ -1873,7 +1920,7 @@ module.exports = (() => {
1873
1920
  *
1874
1921
  * @public
1875
1922
  * @param {Boolean} display - If true, all "display" symbols are returned; otherwise Barchart symbols are returned.
1876
- * @returns {Array.<String>}
1923
+ * @returns {String[]}
1877
1924
  */
1878
1925
  getPositionSymbols(display) {
1879
1926
  const symbols = this._items.reduce((symbols, item) => {
@@ -1937,8 +1984,8 @@ module.exports = (() => {
1937
1984
  * triggering updates to position(s) and data aggregation(s).
1938
1985
  *
1939
1986
  * @public
1940
- * @param {Array.<Object>} positionQuotes
1941
- * @param {Array.<Object>} forexQuotes
1987
+ * @param {Object[]} positionQuotes
1988
+ * @param {Object[]} forexQuotes
1942
1989
  */
1943
1990
  setQuotes(positionQuotes, forexQuotes) {
1944
1991
  assert.argumentIsArray(positionQuotes, 'positionQuotes');
@@ -2000,7 +2047,7 @@ module.exports = (() => {
2000
2047
  * Returns all forex symbols that are required to do currency translations.
2001
2048
  *
2002
2049
  * @public
2003
- * @returns {Array.<String>}
2050
+ * @returns {String[]}
2004
2051
  */
2005
2052
  getForexSymbols() {
2006
2053
  return this._forexSymbols;
@@ -2010,7 +2057,7 @@ module.exports = (() => {
2010
2057
  * Returns all current forex quotes.
2011
2058
  *
2012
2059
  * @public
2013
- * @returns {Array.<Object>}
2060
+ * @returns {Object[]}
2014
2061
  */
2015
2062
  getForexQuotes() {
2016
2063
  return this._forexQuotes;
@@ -2072,7 +2119,7 @@ module.exports = (() => {
2072
2119
  *
2073
2120
  * @public
2074
2121
  * @param {String} name
2075
- * @param {Array.<String>} keys
2122
+ * @param {String[]} keys
2076
2123
  * @returns {PositionGroup}
2077
2124
  */
2078
2125
  getGroup(name, keys) {
@@ -2088,8 +2135,8 @@ module.exports = (() => {
2088
2135
  *
2089
2136
  * @public
2090
2137
  * @param {String} name
2091
- * @param {Array.<String>} keys
2092
- * @returns {Array.<PositionGroup>}
2138
+ * @param {String[]} keys
2139
+ * @returns {PositionGroup[]}
2093
2140
  */
2094
2141
  getGroups(name, keys) {
2095
2142
  assert.argumentIsRequired(name, 'name', String);
@@ -2128,7 +2175,7 @@ module.exports = (() => {
2128
2175
  * Returns all portfolios in the container.
2129
2176
  *
2130
2177
  * @public
2131
- * @returns {Array.<Object>}
2178
+ * @returns {Object[]}
2132
2179
  */
2133
2180
  getPortfolios() {
2134
2181
  return Object.keys(this._portfolios).map(id => this._portfolios[id]);
@@ -2139,7 +2186,7 @@ module.exports = (() => {
2139
2186
  *
2140
2187
  * @public
2141
2188
  * @param {String} portfolio
2142
- * @returns {Array.<Object>}
2189
+ * @returns {Object[]}
2143
2190
  */
2144
2191
  getPositions(portfolio) {
2145
2192
  assert.argumentIsRequired(portfolio, 'portfolio', String);
@@ -2548,7 +2595,7 @@ module.exports = (() => {
2548
2595
  * @public
2549
2596
  * @param {PositionContainer} container
2550
2597
  * @param {LevelDefinition} definition
2551
- * @param {Array.<PositionItem>} items
2598
+ * @param {PositionItem[]} items
2552
2599
  * @param {Currency} currency
2553
2600
  * @param {String} key
2554
2601
  * @param {String} description
@@ -2883,7 +2930,7 @@ module.exports = (() => {
2883
2930
  * Sets the list of items which are excluded from group aggregation calculations.
2884
2931
  *
2885
2932
  * @public
2886
- * @param {Array.<Object>} items
2933
+ * @param {Object[]} items
2887
2934
  */
2888
2935
  setExcludedItems(items) {
2889
2936
  this._excludedItems = items;
@@ -2904,7 +2951,7 @@ module.exports = (() => {
2904
2951
  * Causes aggregated data to be recalculated using a new exchange rate.
2905
2952
  *
2906
2953
  * @public
2907
- * @param {Array.<Rate>} rate
2954
+ * @param {Rate[]} rates
2908
2955
  */
2909
2956
  setForexRates(rates) {
2910
2957
  this._rates = rates;
@@ -3562,7 +3609,7 @@ module.exports = (() => {
3562
3609
  * @param {Object} portfolio
3563
3610
  * @param {Object} position
3564
3611
  * @param {Object} currentSummary
3565
- * @param {Array.<Object>} previousSummaries
3612
+ * @param {Object[]} previousSummaries
3566
3613
  * @param {Boolean} reporting
3567
3614
  */
3568
3615
  class PositionItem extends Disposable {
@@ -4298,7 +4345,7 @@ module.exports = (() => {
4298
4345
  * @param {PositionLevelDefinition~keySelector} keySelector
4299
4346
  * @param {PositionLevelDefinition~descriptionSelector} descriptionSelector
4300
4347
  * @param {PositionLevelDefinition~currencySelector} currencySelector
4301
- * @param {Array.<PositionLevelDefinition~RequiredGroup>=} requiredGroups
4348
+ * @param {PositionLevelDefinition~RequiredGroup[]=} requiredGroups
4302
4349
  * @param {Boolean=} aggregateCash
4303
4350
  * @param {Function=} requiredGroupGenerator
4304
4351
  */
@@ -4599,8 +4646,8 @@ module.exports = (() => {
4599
4646
  *
4600
4647
  * @public
4601
4648
  * @param {String} name
4602
- * @param {Array.<PositionLevelDefinition>} definitions
4603
- * @oaram {Array.<String>=} exclusionDependencies
4649
+ * @param {PositionLevelDefinition[]} definitions
4650
+ * @oaram {String[]=} exclusionDependencies
4604
4651
  */
4605
4652
  class PositionTreeDefinitions {
4606
4653
  constructor(name, definitions, exclusionDependencies) {
@@ -4633,7 +4680,7 @@ module.exports = (() => {
4633
4680
  * bottom-most level of the tree (i.e. leaf nodes).
4634
4681
  *
4635
4682
  * @public
4636
- * @returns {Array.<PositionLevelDefinitions>}
4683
+ * @returns {PositionLevelDefinitions>[]}
4637
4684
  */
4638
4685
  get definitions() {
4639
4686
  return this._definitions;
@@ -4644,7 +4691,7 @@ module.exports = (() => {
4644
4691
  * group (from the current tree) is excluded.
4645
4692
  *
4646
4693
  * @public
4647
- * @returns {Array.<String>}
4694
+ * @returns {String[]}
4648
4695
  */
4649
4696
  get exclusionDependencies() {
4650
4697
  return this._exclusionDependencies;
@@ -5283,7 +5330,7 @@ module.exports = function () {
5283
5330
  *
5284
5331
  * @public
5285
5332
  * @param {*} value - The value of the node.
5286
- * @param {Tree} parent - The parent node. If not supplied, this will be the root node.
5333
+ * @param {Tree=} parent - The parent node. If not supplied, this will be the root node.
5287
5334
  */
5288
5335
 
5289
5336
  var Tree = function () {
@@ -6429,7 +6476,20 @@ module.exports = function () {
6429
6476
  }
6430
6477
 
6431
6478
  /**
6432
- * Returns a new Day instance for the end of the month of the current instance.
6479
+ * Returns a new {@link Day} instance for the start of the month referenced by the current instance.
6480
+ *
6481
+ * @public
6482
+ * @returns {Day}
6483
+ */
6484
+
6485
+ }, {
6486
+ key: 'getStartOfMonth',
6487
+ value: function getStartOfMonth() {
6488
+ return new Day(this.year, this.month, 1);
6489
+ }
6490
+
6491
+ /**
6492
+ * Returns a new instance for the {@link Day} end of the month referenced by the current instance.
6433
6493
  *
6434
6494
  * @public
6435
6495
  * @returns {Day}
@@ -6581,7 +6641,7 @@ module.exports = function () {
6581
6641
  return this._month;
6582
6642
  }
6583
6643
 
6584
- /**
6644
+ /**day
6585
6645
  * The day of the month.
6586
6646
  *
6587
6647
  * @public
@@ -6602,7 +6662,7 @@ module.exports = function () {
6602
6662
  }
6603
6663
 
6604
6664
  /**
6605
- * Converts a string (which matches the output of {@link Day#format} into
6665
+ * Converts a string (which matches the output of {@link Day#format}) into
6606
6666
  * a {@link Day} instance.
6607
6667
  *
6608
6668
  * @public
@@ -6873,6 +6933,24 @@ module.exports = function () {
6873
6933
  return new Decimal(this._big.div(getBig(other)));
6874
6934
  }
6875
6935
 
6936
+ /**
6937
+ * Returns a new {@link Decimal} instance with a value that results
6938
+ * from raising the current instance to the power of the exponent
6939
+ * provided.
6940
+ *
6941
+ * @public
6942
+ * @param {Decimal|Number|String} exponent
6943
+ * @returns {Decimal}
6944
+ */
6945
+
6946
+ }, {
6947
+ key: 'raise',
6948
+ value: function raise(exponent) {
6949
+ assert.argumentIsRequired(exponent, 'exponent', Number);
6950
+
6951
+ return new Decimal(this._big.pow(exponent));
6952
+ }
6953
+
6876
6954
  /**
6877
6955
  * Returns a new {@link Decimal} with a value resulting from a rounding
6878
6956
  * operation on the current value.
@@ -7037,6 +7115,28 @@ module.exports = function () {
7037
7115
  return this._big.eq(getBig(other));
7038
7116
  }
7039
7117
 
7118
+ /**
7119
+ * Returns true is close to another value.
7120
+ *
7121
+ * @public
7122
+ * @param {Decimal|Number|String} other - The value to compare.
7123
+ * @param {Number} places - The significant digits.
7124
+ * @returns {Boolean}
7125
+ */
7126
+
7127
+ }, {
7128
+ key: 'getIsApproximate',
7129
+ value: function getIsApproximate(other, places) {
7130
+ if (places === 0) {
7131
+ return this.getIsEqual(other);
7132
+ }
7133
+
7134
+ var difference = this.subtract(other).absolute();
7135
+ var tolerance = Decimal.ONE.divide(new Decimal(10).raise(places));
7136
+
7137
+ return difference.getIsLessThan(tolerance);
7138
+ }
7139
+
7040
7140
  /**
7041
7141
  * Returns true if the current instance is an integer (i.e. has no decimal
7042
7142
  * component).
@@ -8720,8 +8820,62 @@ module.exports = function () {
8720
8820
  }
8721
8821
 
8722
8822
  return found;
8823
+ },
8824
+
8825
+
8826
+ /**
8827
+ * Inserts an item into an array using a binary search is used to determine the
8828
+ * proper point for insertion and returns the same array.
8829
+ *
8830
+ * @static
8831
+ * @public
8832
+ * @param {Array} a
8833
+ * @param {*} item
8834
+ * @param {Function} comparator
8835
+ * @returns {Array}
8836
+ */
8837
+ insert: function insert(a, item, comparator) {
8838
+ assert.argumentIsArray(a, 'a');
8839
+ assert.argumentIsRequired(comparator, 'comparator', Function);
8840
+
8841
+ if (a.length === 0 || !(comparator(item, a[a.length - 1]) < 0)) {
8842
+ a.push(item);
8843
+ } else if (comparator(item, a[0]) < 0) {
8844
+ a.unshift(item);
8845
+ } else {
8846
+ a.splice(binarySearch(a, item, comparator, 0, a.length - 1), 0, item);
8847
+ }
8848
+
8849
+ return a;
8723
8850
  }
8724
8851
  };
8852
+
8853
+ function binarySearch(array, item, comparator, start, end) {
8854
+ var size = end - start;
8855
+
8856
+ var midpointIndex = start + Math.floor(size / 2);
8857
+ var midpointItem = array[midpointIndex];
8858
+
8859
+ var comparison = comparator(item, midpointItem) > 0;
8860
+
8861
+ if (size < 2) {
8862
+ if (comparison > 0) {
8863
+ var finalIndex = array.length - 1;
8864
+
8865
+ if (end === finalIndex && comparator(item, array[finalIndex]) > 0) {
8866
+ return end + 1;
8867
+ } else {
8868
+ return end;
8869
+ }
8870
+ } else {
8871
+ return start;
8872
+ }
8873
+ } else if (comparison > 0) {
8874
+ return binarySearch(array, item, comparator, midpointIndex, end);
8875
+ } else {
8876
+ return binarySearch(array, item, comparator, start, midpointIndex);
8877
+ }
8878
+ }
8725
8879
  }();
8726
8880
 
8727
8881
  },{"./assert":29,"./is":33}],29:[function(require,module,exports){
@@ -8937,9 +9091,10 @@ module.exports = function () {
8937
9091
  /**
8938
9092
  * Checks to see if an attribute exists on the target object.
8939
9093
  *
9094
+ * @public
8940
9095
  * @static
8941
9096
  * @param {Object} target - The object to check for existence of the property.
8942
- * @param {String|Array.<String>} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
9097
+ * @param {String|String[]} propertyNames - The property to check -- either a string with separators, or an array of strings (already split by separator).
8943
9098
  * @param {String=} separator - The separator (defaults to a period character).
8944
9099
  * @returns {boolean}
8945
9100
  */
@@ -8963,9 +9118,10 @@ module.exports = function () {
8963
9118
  * Returns a value from the target object. If the property doesn't exist; undefined
8964
9119
  * is returned.
8965
9120
  *
9121
+ * @public
8966
9122
  * @static
8967
9123
  * @param {Object} target - The object to read from.
8968
- * @param {String|Array.<String>} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
9124
+ * @param {String|String[]} propertyNames - The property to read -- either a string with separators, or an array of strings (already split by separator).
8969
9125
  * @param {String=} separator - The separator (defaults to a period character).
8970
9126
  * @returns {*}
8971
9127
  */
@@ -8998,9 +9154,10 @@ module.exports = function () {
8998
9154
  /**
8999
9155
  * Writes a value to the target object.
9000
9156
  *
9157
+ * @public
9001
9158
  * @static
9002
9159
  * @param {Object} target - The object to write to.
9003
- * @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
9160
+ * @param {String|String[]} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
9004
9161
  * @param {*} value - The value to assign.
9005
9162
  * @param {String=} separator - The separator (defaults to a period character).
9006
9163
  */
@@ -9025,9 +9182,10 @@ module.exports = function () {
9025
9182
  /**
9026
9183
  * Erases a property from the target object.
9027
9184
  *
9185
+ * @public
9028
9186
  * @static
9029
9187
  * @param {Object} target - The object to erase a property from.
9030
- * @param {String|Array.<String>} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
9188
+ * @param {String|String} propertyNames - The property to write -- either a string with separators, or an array of strings (already split by separator).
9031
9189
  * @param {String=} separator - The separator (defaults to a period character).
9032
9190
  */
9033
9191
  erase: function erase(target, propertyNames, separator) {
@@ -9242,7 +9400,7 @@ module.exports = function () {
9242
9400
  * @static
9243
9401
  * @public
9244
9402
  * @param {*} candidate
9245
- * @returns {*|boolean}
9403
+ * @returns {boolean}
9246
9404
  */
9247
9405
  negative: function negative(candidate) {
9248
9406
  return this.number(candidate) && candidate < 0;
@@ -9953,6 +10111,20 @@ module.exports = function () {
9953
10111
  return dataTypeObject;
9954
10112
  }
9955
10113
 
10114
+ /**
10115
+ * References an array.
10116
+ *
10117
+ * @public
10118
+ * @static
10119
+ * @returns {DataType}
10120
+ */
10121
+
10122
+ }, {
10123
+ key: 'ARRAY',
10124
+ get: function get() {
10125
+ return dataTypeArray;
10126
+ }
10127
+
9956
10128
  /**
9957
10129
  * References a {@link Decimal} instance.
9958
10130
  *
@@ -10021,6 +10193,7 @@ module.exports = function () {
10021
10193
  var dataTypeNumber = new DataType('Number', null, null, is.number);
10022
10194
  var dataTypeBoolean = new DataType('Boolean', null, null, is.boolean);
10023
10195
  var dataTypeObject = new DataType('Object', null, null, is.object);
10196
+ var dataTypeArray = new DataType('Array', null, null, is.array);
10024
10197
 
10025
10198
  var dataTypeDecimal = new DataType('Decimal', null, function (x) {
10026
10199
  return Decimal.parse(x);
@@ -10043,7 +10216,7 @@ module.exports = function () {
10043
10216
  return x instanceof AdHoc;
10044
10217
  }, getBuilder(buildAdHoc));
10045
10218
 
10046
- var dataTypes = [dataTypeString, dataTypeNumber, dataTypeBoolean, dataTypeObject, dataTypeDecimal, dataTypeDay, dataTypeTimestamp, dataTypeAdHoc];
10219
+ var dataTypes = [dataTypeString, dataTypeNumber, dataTypeBoolean, dataTypeObject, dataTypeArray, dataTypeDecimal, dataTypeDay, dataTypeTimestamp, dataTypeAdHoc];
10047
10220
 
10048
10221
  function getBuilder(builder) {
10049
10222
  return function (data) {