@barchart/portfolio-api-common 1.0.167 → 1.0.168
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/lib/processing/PositionContainer.js +46 -5
- package/lib/processing/PositionGroup.js +34 -7
- package/package.json +1 -1
- package/test/SpecRunner.js +148 -15
|
@@ -11,7 +11,9 @@ const array = require('@barchart/common-js/lang/array'),
|
|
|
11
11
|
|
|
12
12
|
const PositionSummaryFrame = require('./../data/PositionSummaryFrame');
|
|
13
13
|
|
|
14
|
-
const
|
|
14
|
+
const PositionLevelDefinition = require('./definitions/PositionLevelDefinition'),
|
|
15
|
+
PositionLevelType = require('./definitions/PositionLevelType'),
|
|
16
|
+
PositionTreeDefinition = require('./definitions/PositionTreeDefinition');
|
|
15
17
|
|
|
16
18
|
const PositionGroup = require('./PositionGroup'),
|
|
17
19
|
PositionItem = require('./PositionItem');
|
|
@@ -128,10 +130,9 @@ module.exports = (() => {
|
|
|
128
130
|
}, { });
|
|
129
131
|
|
|
130
132
|
this._currencies = this._items.reduce((map, item) => {
|
|
131
|
-
const
|
|
133
|
+
const currency = extractCurrency(item.position);
|
|
132
134
|
|
|
133
|
-
if (
|
|
134
|
-
const currency = position.instrument.currency;
|
|
135
|
+
if (currency) {
|
|
135
136
|
const code = currency.code;
|
|
136
137
|
|
|
137
138
|
if (!map.hasOwnProperty(code)) {
|
|
@@ -246,7 +247,17 @@ module.exports = (() => {
|
|
|
246
247
|
|
|
247
248
|
itemsToRemove.forEach(item => removePositionItem.call(this, item));
|
|
248
249
|
|
|
250
|
+
delete this._portfolios[portfolio.portfolio];
|
|
251
|
+
|
|
252
|
+
Object.keys(this._trees).forEach((key) => {
|
|
253
|
+
const tree = this._tree[key];
|
|
249
254
|
|
|
255
|
+
tree.walk((group, groupNode) => {
|
|
256
|
+
if (group.definition.type === PositionLevelType.PORTFOLIO && group.key === PositionLevelDefinition.getKeyForPortfolioGroup(portfolio)) {
|
|
257
|
+
groupNode.sever();
|
|
258
|
+
}
|
|
259
|
+
}, true, false);
|
|
260
|
+
});
|
|
250
261
|
});
|
|
251
262
|
}
|
|
252
263
|
|
|
@@ -338,7 +349,6 @@ module.exports = (() => {
|
|
|
338
349
|
assert.argumentIsRequired(quote, 'quote', Object);
|
|
339
350
|
|
|
340
351
|
const rate = Rate.fromPair(quote.lastPrice, symbol);
|
|
341
|
-
|
|
342
352
|
const index = this._forexQuotes.findIndex(existing => existing.formatPair() === rate.formatPair());
|
|
343
353
|
|
|
344
354
|
if (index < 0) {
|
|
@@ -517,6 +527,14 @@ module.exports = (() => {
|
|
|
517
527
|
}
|
|
518
528
|
}
|
|
519
529
|
|
|
530
|
+
function extractCurrency(position) {
|
|
531
|
+
if (position.instrument && position.instrument.currency) {
|
|
532
|
+
return position.instrument.currency;
|
|
533
|
+
} else {
|
|
534
|
+
return null;
|
|
535
|
+
}
|
|
536
|
+
}
|
|
537
|
+
|
|
520
538
|
function addGroupBinding(group, dispoable) {
|
|
521
539
|
const id = group.id;
|
|
522
540
|
|
|
@@ -661,6 +679,29 @@ module.exports = (() => {
|
|
|
661
679
|
return;
|
|
662
680
|
}
|
|
663
681
|
|
|
682
|
+
delete this._summariesCurrent[positionItem.position.position];
|
|
683
|
+
delete this._summariesPrevious[positionItem.position.position];
|
|
684
|
+
|
|
685
|
+
array.remove(this._items, i => i === positionItem);
|
|
686
|
+
|
|
687
|
+
const barchartSymbol = extractSymbolForBarchart(positionItem.position);
|
|
688
|
+
|
|
689
|
+
if (this._symbols.hasOwnProperty(barchartSymbol)) {
|
|
690
|
+
array.remove(this._symbols[barchartSymbol], i => i === positionItem);
|
|
691
|
+
}
|
|
692
|
+
|
|
693
|
+
const displaySymbol = extractSymbolForDisplay(positionItem.position);
|
|
694
|
+
|
|
695
|
+
if (this._symbolsDisplay.hasOwnProperty(displaySymbol)) {
|
|
696
|
+
array.remove(this._symbols[displaySymbol], i => i === positionItem);
|
|
697
|
+
}
|
|
698
|
+
|
|
699
|
+
const currency = extractCurrency(positionItem.position);
|
|
700
|
+
|
|
701
|
+
if (currency && this._currencies.hasOwnProperty(currency.code)) {
|
|
702
|
+
array.remove(this._currencies[currency.code], i => i === positionItem);
|
|
703
|
+
}
|
|
704
|
+
|
|
664
705
|
positionItem.dispose();
|
|
665
706
|
}
|
|
666
707
|
|
|
@@ -2,6 +2,7 @@ const array = require('@barchart/common-js/lang/array'),
|
|
|
2
2
|
assert = require('@barchart/common-js/lang/assert'),
|
|
3
3
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
4
4
|
Decimal = require('@barchart/common-js/lang/Decimal'),
|
|
5
|
+
Disposable = require('@barchart/common-js/lang/Disposable'),
|
|
5
6
|
DisposableStack = require('@barchart/common-js/collections/specialized/DisposableStack'),
|
|
6
7
|
Event = require('@barchart/common-js/messaging/Event'),
|
|
7
8
|
formatter = require('@barchart/common-js/lang/formatter'),
|
|
@@ -149,7 +150,7 @@ module.exports = (() => {
|
|
|
149
150
|
this._dataFormat.portfolioType = null;
|
|
150
151
|
|
|
151
152
|
this._items.forEach((item) => {
|
|
152
|
-
|
|
153
|
+
const quoteBinding = item.registerQuoteChangeHandler((quote, sender) => {
|
|
153
154
|
if (this._single) {
|
|
154
155
|
const precision = sender.position.instrument.currency.precision;
|
|
155
156
|
|
|
@@ -185,18 +186,39 @@ module.exports = (() => {
|
|
|
185
186
|
}
|
|
186
187
|
|
|
187
188
|
calculatePriceData(this, this._container.getForexQuotes(), sender, false);
|
|
188
|
-
})
|
|
189
|
+
});
|
|
190
|
+
|
|
191
|
+
let newsBinding = Disposable.getEmpty();
|
|
192
|
+
let fundamentalBinding = Disposable.getEmpty();
|
|
189
193
|
|
|
190
194
|
if (this._single) {
|
|
191
|
-
|
|
195
|
+
newsBinding = item.registerNewsExistsChangeHandler((exists, sender) => {
|
|
192
196
|
this._dataActual.newsExists = exists;
|
|
193
197
|
this._dataFormat.newsExists = exists;
|
|
194
|
-
})
|
|
198
|
+
});
|
|
195
199
|
|
|
196
|
-
|
|
200
|
+
fundamentalBinding = item.registerFundamentalDataChangeHandler((data, sender) => {
|
|
197
201
|
this._dataFormat.fundamental = data;
|
|
198
|
-
})
|
|
202
|
+
});
|
|
199
203
|
}
|
|
204
|
+
|
|
205
|
+
this._disposeStack.push(quoteBinding);
|
|
206
|
+
this._disposeStack.push(newsBinding);
|
|
207
|
+
this._disposeStack.push(fundamentalBinding);
|
|
208
|
+
|
|
209
|
+
this._disposeStack.push(item.registerPositionItemDisposeHandler(() => {
|
|
210
|
+
quoteBinding.dispose();
|
|
211
|
+
newsBinding.dispose();
|
|
212
|
+
fundamentalBinding.dispose();
|
|
213
|
+
|
|
214
|
+
array.remove(this._items, i => i === item);
|
|
215
|
+
array.remove(this._excludedItems, i => i === item);
|
|
216
|
+
array.remove(this._consideredItems, i => i === item);
|
|
217
|
+
|
|
218
|
+
delete this._excludedItemMap[item.position.position];
|
|
219
|
+
|
|
220
|
+
this.refresh();
|
|
221
|
+
}));
|
|
200
222
|
});
|
|
201
223
|
|
|
202
224
|
this.refresh();
|
|
@@ -392,11 +414,16 @@ module.exports = (() => {
|
|
|
392
414
|
}
|
|
393
415
|
|
|
394
416
|
/**
|
|
395
|
-
* Causes all aggregated data to be recalculated
|
|
417
|
+
* Causes all aggregated data to be recalculated (assuming the group has not
|
|
418
|
+
* been suspended).
|
|
396
419
|
*
|
|
397
420
|
* @public
|
|
398
421
|
*/
|
|
399
422
|
refresh() {
|
|
423
|
+
if (this._suspended) {
|
|
424
|
+
return;
|
|
425
|
+
}
|
|
426
|
+
|
|
400
427
|
const rates = this._container.getForexQuotes();
|
|
401
428
|
|
|
402
429
|
calculateStaticData(this, rates);
|
package/package.json
CHANGED
package/test/SpecRunner.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
(function(){function e
|
|
1
|
+
(function(){function r(e,n,t){function o(i,f){if(!n[i]){if(!e[i]){var c="function"==typeof require&&require;if(!f&&c)return c(i,!0);if(u)return u(i,!0);var a=new Error("Cannot find module '"+i+"'");throw a.code="MODULE_NOT_FOUND",a}var p=n[i]={exports:{}};e[i][0].call(p.exports,function(r){var n=e[i][1][r];return o(n||r)},p,p.exports,r,e,n,t)}return n[i].exports}for(var u="function"==typeof require&&require,i=0;i<t.length;i++)o(t[i]);return o}return r})()({1:[function(require,module,exports){
|
|
2
2
|
const assert = require('@barchart/common-js/lang/assert'),
|
|
3
3
|
Enum = require('@barchart/common-js/lang/Enum');
|
|
4
4
|
|
|
@@ -727,7 +727,9 @@ const array = require('@barchart/common-js/lang/array'),
|
|
|
727
727
|
|
|
728
728
|
const PositionSummaryFrame = require('./../data/PositionSummaryFrame');
|
|
729
729
|
|
|
730
|
-
const
|
|
730
|
+
const PositionLevelDefinition = require('./definitions/PositionLevelDefinition'),
|
|
731
|
+
PositionLevelType = require('./definitions/PositionLevelType'),
|
|
732
|
+
PositionTreeDefinition = require('./definitions/PositionTreeDefinition');
|
|
731
733
|
|
|
732
734
|
const PositionGroup = require('./PositionGroup'),
|
|
733
735
|
PositionItem = require('./PositionItem');
|
|
@@ -844,10 +846,9 @@ module.exports = (() => {
|
|
|
844
846
|
}, { });
|
|
845
847
|
|
|
846
848
|
this._currencies = this._items.reduce((map, item) => {
|
|
847
|
-
const
|
|
849
|
+
const currency = extractCurrency(item.position);
|
|
848
850
|
|
|
849
|
-
if (
|
|
850
|
-
const currency = position.instrument.currency;
|
|
851
|
+
if (currency) {
|
|
851
852
|
const code = currency.code;
|
|
852
853
|
|
|
853
854
|
if (!map.hasOwnProperty(code)) {
|
|
@@ -962,7 +963,17 @@ module.exports = (() => {
|
|
|
962
963
|
|
|
963
964
|
itemsToRemove.forEach(item => removePositionItem.call(this, item));
|
|
964
965
|
|
|
966
|
+
delete this._portfolios[portfolio.portfolio];
|
|
967
|
+
|
|
968
|
+
Object.keys(this._trees).forEach((key) => {
|
|
969
|
+
const tree = this._tree[key];
|
|
965
970
|
|
|
971
|
+
tree.walk((group, groupNode) => {
|
|
972
|
+
if (group.definition.type === PositionLevelType.PORTFOLIO && group.key === PositionLevelDefinition.getKeyForPortfolioGroup(portfolio)) {
|
|
973
|
+
groupNode.sever();
|
|
974
|
+
}
|
|
975
|
+
}, true, false);
|
|
976
|
+
});
|
|
966
977
|
});
|
|
967
978
|
}
|
|
968
979
|
|
|
@@ -1054,7 +1065,6 @@ module.exports = (() => {
|
|
|
1054
1065
|
assert.argumentIsRequired(quote, 'quote', Object);
|
|
1055
1066
|
|
|
1056
1067
|
const rate = Rate.fromPair(quote.lastPrice, symbol);
|
|
1057
|
-
|
|
1058
1068
|
const index = this._forexQuotes.findIndex(existing => existing.formatPair() === rate.formatPair());
|
|
1059
1069
|
|
|
1060
1070
|
if (index < 0) {
|
|
@@ -1233,6 +1243,14 @@ module.exports = (() => {
|
|
|
1233
1243
|
}
|
|
1234
1244
|
}
|
|
1235
1245
|
|
|
1246
|
+
function extractCurrency(position) {
|
|
1247
|
+
if (position.instrument && position.instrument.currency) {
|
|
1248
|
+
return position.instrument.currency;
|
|
1249
|
+
} else {
|
|
1250
|
+
return null;
|
|
1251
|
+
}
|
|
1252
|
+
}
|
|
1253
|
+
|
|
1236
1254
|
function addGroupBinding(group, dispoable) {
|
|
1237
1255
|
const id = group.id;
|
|
1238
1256
|
|
|
@@ -1377,17 +1395,41 @@ module.exports = (() => {
|
|
|
1377
1395
|
return;
|
|
1378
1396
|
}
|
|
1379
1397
|
|
|
1398
|
+
delete this._summariesCurrent[positionItem.position.position];
|
|
1399
|
+
delete this._summariesPrevious[positionItem.position.position];
|
|
1400
|
+
|
|
1401
|
+
array.remove(this._items, i => i === positionItem);
|
|
1402
|
+
|
|
1403
|
+
const barchartSymbol = extractSymbolForBarchart(positionItem.position);
|
|
1404
|
+
|
|
1405
|
+
if (this._symbols.hasOwnProperty(barchartSymbol)) {
|
|
1406
|
+
array.remove(this._symbols[barchartSymbol], i => i === positionItem);
|
|
1407
|
+
}
|
|
1408
|
+
|
|
1409
|
+
const displaySymbol = extractSymbolForDisplay(positionItem.position);
|
|
1410
|
+
|
|
1411
|
+
if (this._symbolsDisplay.hasOwnProperty(displaySymbol)) {
|
|
1412
|
+
array.remove(this._symbols[displaySymbol], i => i === positionItem);
|
|
1413
|
+
}
|
|
1414
|
+
|
|
1415
|
+
const currency = extractCurrency(positionItem.position);
|
|
1416
|
+
|
|
1417
|
+
if (currency && this._currencies.hasOwnProperty(currency.code)) {
|
|
1418
|
+
array.remove(this._currencies[currency.code], i => i === positionItem);
|
|
1419
|
+
}
|
|
1420
|
+
|
|
1380
1421
|
positionItem.dispose();
|
|
1381
1422
|
}
|
|
1382
1423
|
|
|
1383
1424
|
return PositionContainer;
|
|
1384
1425
|
})();
|
|
1385
1426
|
|
|
1386
|
-
},{"./../data/PositionSummaryFrame":2,"./PositionGroup":5,"./PositionItem":6,"./definitions/PositionTreeDefinition":9,"@barchart/common-js/collections/Tree":11,"@barchart/common-js/collections/sorting/ComparatorBuilder":12,"@barchart/common-js/collections/sorting/comparators":13,"@barchart/common-js/collections/specialized/DisposableStack":14,"@barchart/common-js/lang/Currency":15,"@barchart/common-js/lang/Decimal":17,"@barchart/common-js/lang/Rate":20,"@barchart/common-js/lang/array":21,"@barchart/common-js/lang/assert":22,"@barchart/common-js/lang/is":24}],5:[function(require,module,exports){
|
|
1427
|
+
},{"./../data/PositionSummaryFrame":2,"./PositionGroup":5,"./PositionItem":6,"./definitions/PositionLevelDefinition":7,"./definitions/PositionLevelType":8,"./definitions/PositionTreeDefinition":9,"@barchart/common-js/collections/Tree":11,"@barchart/common-js/collections/sorting/ComparatorBuilder":12,"@barchart/common-js/collections/sorting/comparators":13,"@barchart/common-js/collections/specialized/DisposableStack":14,"@barchart/common-js/lang/Currency":15,"@barchart/common-js/lang/Decimal":17,"@barchart/common-js/lang/Rate":20,"@barchart/common-js/lang/array":21,"@barchart/common-js/lang/assert":22,"@barchart/common-js/lang/is":24}],5:[function(require,module,exports){
|
|
1387
1428
|
const array = require('@barchart/common-js/lang/array'),
|
|
1388
1429
|
assert = require('@barchart/common-js/lang/assert'),
|
|
1389
1430
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
1390
1431
|
Decimal = require('@barchart/common-js/lang/Decimal'),
|
|
1432
|
+
Disposable = require('@barchart/common-js/lang/Disposable'),
|
|
1391
1433
|
DisposableStack = require('@barchart/common-js/collections/specialized/DisposableStack'),
|
|
1392
1434
|
Event = require('@barchart/common-js/messaging/Event'),
|
|
1393
1435
|
formatter = require('@barchart/common-js/lang/formatter'),
|
|
@@ -1535,7 +1577,7 @@ module.exports = (() => {
|
|
|
1535
1577
|
this._dataFormat.portfolioType = null;
|
|
1536
1578
|
|
|
1537
1579
|
this._items.forEach((item) => {
|
|
1538
|
-
|
|
1580
|
+
const quoteBinding = item.registerQuoteChangeHandler((quote, sender) => {
|
|
1539
1581
|
if (this._single) {
|
|
1540
1582
|
const precision = sender.position.instrument.currency.precision;
|
|
1541
1583
|
|
|
@@ -1571,18 +1613,39 @@ module.exports = (() => {
|
|
|
1571
1613
|
}
|
|
1572
1614
|
|
|
1573
1615
|
calculatePriceData(this, this._container.getForexQuotes(), sender, false);
|
|
1574
|
-
})
|
|
1616
|
+
});
|
|
1617
|
+
|
|
1618
|
+
let newsBinding = Disposable.getEmpty();
|
|
1619
|
+
let fundamentalBinding = Disposable.getEmpty();
|
|
1575
1620
|
|
|
1576
1621
|
if (this._single) {
|
|
1577
|
-
|
|
1622
|
+
newsBinding = item.registerNewsExistsChangeHandler((exists, sender) => {
|
|
1578
1623
|
this._dataActual.newsExists = exists;
|
|
1579
1624
|
this._dataFormat.newsExists = exists;
|
|
1580
|
-
})
|
|
1625
|
+
});
|
|
1581
1626
|
|
|
1582
|
-
|
|
1627
|
+
fundamentalBinding = item.registerFundamentalDataChangeHandler((data, sender) => {
|
|
1583
1628
|
this._dataFormat.fundamental = data;
|
|
1584
|
-
})
|
|
1629
|
+
});
|
|
1585
1630
|
}
|
|
1631
|
+
|
|
1632
|
+
this._disposeStack.push(quoteBinding);
|
|
1633
|
+
this._disposeStack.push(newsBinding);
|
|
1634
|
+
this._disposeStack.push(fundamentalBinding);
|
|
1635
|
+
|
|
1636
|
+
this._disposeStack.push(item.registerPositionItemDisposeHandler(() => {
|
|
1637
|
+
quoteBinding.dispose();
|
|
1638
|
+
newsBinding.dispose();
|
|
1639
|
+
fundamentalBinding.dispose();
|
|
1640
|
+
|
|
1641
|
+
array.remove(this._items, i => i === item);
|
|
1642
|
+
array.remove(this._excludedItems, i => i === item);
|
|
1643
|
+
array.remove(this._consideredItems, i => i === item);
|
|
1644
|
+
|
|
1645
|
+
delete this._excludedItemMap[item.position.position];
|
|
1646
|
+
|
|
1647
|
+
this.refresh();
|
|
1648
|
+
}));
|
|
1586
1649
|
});
|
|
1587
1650
|
|
|
1588
1651
|
this.refresh();
|
|
@@ -1778,11 +1841,16 @@ module.exports = (() => {
|
|
|
1778
1841
|
}
|
|
1779
1842
|
|
|
1780
1843
|
/**
|
|
1781
|
-
* Causes all aggregated data to be recalculated
|
|
1844
|
+
* Causes all aggregated data to be recalculated (assuming the group has not
|
|
1845
|
+
* been suspended).
|
|
1782
1846
|
*
|
|
1783
1847
|
* @public
|
|
1784
1848
|
*/
|
|
1785
1849
|
refresh() {
|
|
1850
|
+
if (this._suspended) {
|
|
1851
|
+
return;
|
|
1852
|
+
}
|
|
1853
|
+
|
|
1786
1854
|
const rates = this._container.getForexQuotes();
|
|
1787
1855
|
|
|
1788
1856
|
calculateStaticData(this, rates);
|
|
@@ -2097,7 +2165,7 @@ module.exports = (() => {
|
|
|
2097
2165
|
return PositionGroup;
|
|
2098
2166
|
})();
|
|
2099
2167
|
|
|
2100
|
-
},{"./../data/InstrumentType":1,"@barchart/common-js/collections/specialized/DisposableStack":14,"@barchart/common-js/lang/Currency":15,"@barchart/common-js/lang/Decimal":17,"@barchart/common-js/lang/Rate":20,"@barchart/common-js/lang/array":21,"@barchart/common-js/lang/assert":22,"@barchart/common-js/lang/formatter":23,"@barchart/common-js/lang/is":24,"@barchart/common-js/messaging/Event":26}],6:[function(require,module,exports){
|
|
2168
|
+
},{"./../data/InstrumentType":1,"@barchart/common-js/collections/specialized/DisposableStack":14,"@barchart/common-js/lang/Currency":15,"@barchart/common-js/lang/Decimal":17,"@barchart/common-js/lang/Disposable":18,"@barchart/common-js/lang/Rate":20,"@barchart/common-js/lang/array":21,"@barchart/common-js/lang/assert":22,"@barchart/common-js/lang/formatter":23,"@barchart/common-js/lang/is":24,"@barchart/common-js/messaging/Event":26}],6:[function(require,module,exports){
|
|
2101
2169
|
const array = require('@barchart/common-js/lang/array'),
|
|
2102
2170
|
assert = require('@barchart/common-js/lang/assert'),
|
|
2103
2171
|
Currency = require('@barchart/common-js/lang/Currency'),
|
|
@@ -3157,6 +3225,23 @@ module.exports = function () {
|
|
|
3157
3225
|
}
|
|
3158
3226
|
}
|
|
3159
3227
|
|
|
3228
|
+
/**
|
|
3229
|
+
* Removes the current node from the parent tree. Use on a root node
|
|
3230
|
+
* has no effect.
|
|
3231
|
+
*
|
|
3232
|
+
* @public
|
|
3233
|
+
*/
|
|
3234
|
+
|
|
3235
|
+
}, {
|
|
3236
|
+
key: 'sever',
|
|
3237
|
+
value: function sever() {
|
|
3238
|
+
if (this.getIsRoot()) {
|
|
3239
|
+
return;
|
|
3240
|
+
}
|
|
3241
|
+
|
|
3242
|
+
this.getParent().removeChild(this);
|
|
3243
|
+
}
|
|
3244
|
+
|
|
3160
3245
|
/**
|
|
3161
3246
|
* Searches the children nodes for the first child node that matches the
|
|
3162
3247
|
* predicate.
|
|
@@ -4551,6 +4636,20 @@ module.exports = function () {
|
|
|
4551
4636
|
return this._big.gt(getBig(other));
|
|
4552
4637
|
}
|
|
4553
4638
|
|
|
4639
|
+
/**
|
|
4640
|
+
* Returns true if the current instance is greater than or equal to the value.
|
|
4641
|
+
*
|
|
4642
|
+
* @public
|
|
4643
|
+
* @param {Decimal|Number|String} other - The value to compare.
|
|
4644
|
+
* @returns {Boolean}
|
|
4645
|
+
*/
|
|
4646
|
+
|
|
4647
|
+
}, {
|
|
4648
|
+
key: 'getIsGreaterThanOrEqual',
|
|
4649
|
+
value: function getIsGreaterThanOrEqual(other) {
|
|
4650
|
+
return this._big.gte(getBig(other));
|
|
4651
|
+
}
|
|
4652
|
+
|
|
4554
4653
|
/**
|
|
4555
4654
|
* Returns true if the current instance is less than the value.
|
|
4556
4655
|
*
|
|
@@ -4565,6 +4664,20 @@ module.exports = function () {
|
|
|
4565
4664
|
return this._big.lt(getBig(other));
|
|
4566
4665
|
}
|
|
4567
4666
|
|
|
4667
|
+
/**
|
|
4668
|
+
* Returns true if the current instance is less than or equal to the value.
|
|
4669
|
+
*
|
|
4670
|
+
* @public
|
|
4671
|
+
* @param {Decimal|Number|String} other - The value to compare.
|
|
4672
|
+
* @returns {Boolean}
|
|
4673
|
+
*/
|
|
4674
|
+
|
|
4675
|
+
}, {
|
|
4676
|
+
key: 'getIsLessThanOrEqual',
|
|
4677
|
+
value: function getIsLessThanOrEqual(other) {
|
|
4678
|
+
return this._big.lte(getBig(other));
|
|
4679
|
+
}
|
|
4680
|
+
|
|
4568
4681
|
/**
|
|
4569
4682
|
* Returns true if the current instance is equal to the value.
|
|
4570
4683
|
*
|
|
@@ -5851,6 +5964,26 @@ module.exports = function () {
|
|
|
5851
5964
|
});
|
|
5852
5965
|
|
|
5853
5966
|
return returnRef;
|
|
5967
|
+
},
|
|
5968
|
+
|
|
5969
|
+
|
|
5970
|
+
/**
|
|
5971
|
+
* Removes the first item from an array which matches a predicate.
|
|
5972
|
+
*
|
|
5973
|
+
* @static
|
|
5974
|
+
* @public
|
|
5975
|
+
* @param {Array} a
|
|
5976
|
+
* @param {Function} predicate
|
|
5977
|
+
*/
|
|
5978
|
+
remove: function remove(a, predicate) {
|
|
5979
|
+
assert.argumentIsArray(a, 'a');
|
|
5980
|
+
assert.argumentIsRequired(predicate, 'predicate', Function);
|
|
5981
|
+
|
|
5982
|
+
var index = a.findIndex(predicate);
|
|
5983
|
+
|
|
5984
|
+
if (!(index < 0)) {
|
|
5985
|
+
a.splice(index, 1);
|
|
5986
|
+
}
|
|
5854
5987
|
}
|
|
5855
5988
|
};
|
|
5856
5989
|
}();
|