@barchart/portfolio-api-common 1.2.76 → 1.2.77

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.
@@ -371,15 +371,17 @@ module.exports = (() => {
371
371
  }
372
372
 
373
373
  setPositionLock(position) {
374
- assert.argumentIsRequired(position, 'position', Object);
375
- assert.argumentIsRequired(position.position, 'position.position', String);
374
+ if (position) {
375
+ assert.argumentIsRequired(position, 'position', Object);
376
+ assert.argumentIsRequired(position.position, 'position.position', String);
376
377
 
377
- const item = this._items.find((i) => i.position.position === position.position);
378
+ const item = this._items.find((i) => i.position.position === position.position);
378
379
 
379
- if (item) {
380
- const locked = is.object(position.system) && is.boolean(position.system.locked) && position.system.locked;
380
+ if (item) {
381
+ const locked = is.object(position.system) && is.boolean(position.system.locked) && position.system.locked;
381
382
 
382
- item.setPositionLock(locked);
383
+ item.setPositionLock(locked);
384
+ }
383
385
  }
384
386
  }
385
387
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@barchart/portfolio-api-common",
3
- "version": "1.2.76",
3
+ "version": "1.2.77",
4
4
  "description": "Common classes used by the Portfolio system",
5
5
  "author": {
6
6
  "name": "Bryan Ingle",
@@ -1750,15 +1750,17 @@ module.exports = (() => {
1750
1750
  }
1751
1751
 
1752
1752
  setPositionLock(position) {
1753
- assert.argumentIsRequired(position, 'position', Object);
1754
- assert.argumentIsRequired(position.position, 'position.position', String);
1753
+ if (position) {
1754
+ assert.argumentIsRequired(position, 'position', Object);
1755
+ assert.argumentIsRequired(position.position, 'position.position', String);
1755
1756
 
1756
- const item = this._items.find((i) => i.position.position === position.position);
1757
+ const item = this._items.find((i) => i.position.position === position.position);
1757
1758
 
1758
- if (item) {
1759
- const locked = is.object(position.system) && is.boolean(position.system.locked) && position.system.locked;
1759
+ if (item) {
1760
+ const locked = is.object(position.system) && is.boolean(position.system.locked) && position.system.locked;
1760
1761
 
1761
- item.setPositionLock(locked);
1762
+ item.setPositionLock(locked);
1763
+ }
1762
1764
  }
1763
1765
  }
1764
1766