Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

fix: null check for some load out values #8

Merged
merged 2 commits into from
Apr 18, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@
"prettier --write",
"npm -q --no-progress dedupe"
],
"*.{json,md,yaml}": [
"*.{json,md,yaml},!test/data/*.json": [
"prettier --write"
]
}
Expand Down
12 changes: 6 additions & 6 deletions src/LoadOutInventory.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,21 +22,21 @@ export default class LoadOutInventory {

/**
* An array of the player's currently equiped secondary weapon
* @type {LoadOutItem}
* @type {LoadOutItem | undefined}
*/
this.secondary = item.Pistols.map((p) => new LoadOutItem(p));
this.secondary = item.Pistols?.map((p) => new LoadOutItem(p));

/**
* An array of the player's currently equiped primary weapon
* @type {LoadOutItem}
* @type {LoadOutItem | undefined}
*/
this.primary = item.LongGuns.map((lg) => new LoadOutItem(lg));
this.primary = item.LongGuns?.map((lg) => new LoadOutItem(lg));

/**
* An array of the player's currently equiped melee weapon
* @type {LoadOutItem}
* @type {LoadOutItem | undefined}
*/
this.melee = item.Melee.map((m) => new LoadOutItem(m));
this.melee = item.Melee?.map((m) => new LoadOutItem(m));

/**
* Items that have counted towards the players mastery rank
Expand Down
4 changes: 2 additions & 2 deletions src/LoadOutItem.js
Original file line number Diff line number Diff line change
Expand Up @@ -90,9 +90,9 @@ export default class LoadOutItem {

/**
* Which polarity types exist on the weapon
* @type {Array<Polarity>}
* @type {Array<Polarity> | undefined}
*/
this.polarity = weapon.Polarity.map((p) => new Polarity(p));
this.polarity = weapon.Polarity?.map((p) => new Polarity(p));

/**
* Focus lens applied
Expand Down
4 changes: 2 additions & 2 deletions src/OperatorLoadOuts.js
Original file line number Diff line number Diff line change
Expand Up @@ -16,9 +16,9 @@ export default class OperatorLoadOuts {

/**
* Operator amp ID
* @type {String}
* @type {String | undefined}
*/
this.operatorAmp = loadout.OperatorAmp.$oid;
this.operatorAmp = loadout.OperatorAmp?.$oid;

/**
* Applied upgrade IDs
Expand Down
4 changes: 2 additions & 2 deletions src/Profile.js
Original file line number Diff line number Diff line change
Expand Up @@ -180,9 +180,9 @@ export default class Profile {

/**
* Operator loadout
* @type {OperatorLoadOuts}
* @type {OperatorLoadOuts | undefined}
*/
this.operatorLoadouts = profile.OperatorLoadOuts.map((ol) => new OperatorLoadOuts(ol));
this.operatorLoadouts = profile.OperatorLoadOuts?.map((ol) => new OperatorLoadOuts(ol));

/**
* Player's alignment
Expand Down
Loading