Skip to content

Commit

Permalink
code cleanup
Browse files Browse the repository at this point in the history
  • Loading branch information
NB10328 authored and NB10328 committed Nov 26, 2020
1 parent 1c6f5bd commit 7f93aa2
Show file tree
Hide file tree
Showing 2 changed files with 3 additions and 10 deletions.
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
{
"name": "swgoh-api-swgohgg",
"version": "0.0.3",
"version": "0.0.4",
"description": "SWGoH helper API for swgoh.gg",
"main": "index.js",
"keywords": [
Expand Down
11 changes: 2 additions & 9 deletions swgohgg-api.js
Original file line number Diff line number Diff line change
Expand Up @@ -575,16 +575,9 @@ class SwgohGGApi {
static getPlayerUnitFromUnits(player, searchName) {
var result;

// loop over characters
for (var i = 0; i < player.units.length; i++) {
const unit = player.units[i].data;
const playerUnit = player.units.find(unit => unit.data.name.toLowerCase() == searchName.toLowerCase());

// test for name (ignoring case)
if (unit.name.toLowerCase() == searchName.toLowerCase()) {
result = unit;
break;
}
}
if (playerUnit) result = playerUnit.data;

return result;
}
Expand Down

0 comments on commit 7f93aa2

Please sign in to comment.