UNPKG

@xmobitea/gn-typescript-client

Version:

GearN Typescript Client SDK by XmobiTea (Pro)

73 lines (72 loc) 2.15 kB
export class GNUtils { static toDatasDictionary(datas) { if (datas == null) return null; let answer = new Map(); for (let i = 0; i < datas.length; i++) { let data = datas[i]; answer.set(data.key, data); } return answer; } static toTagsDictionary(tags) { if (tags == null) return null; let answer = new Map(); for (let i = 0; i < tags.length; i++) { let tag = tags[i]; answer.set(tag.key, tag); } return answer; } static toCurrenciesDictionary(currencies) { if (currencies == null) return null; let answer = new Map(); for (let i = 0; i < currencies.length; i++) { let currency = currencies[i]; answer.set(currency.key, currency); } return answer; } static toStatisticsDictionary(statistics) { if (statistics == null) return null; let answer = new Map(); for (let i = 0; i < statistics.length; i++) { let statistic = statistics[i]; answer.set(statistic.key, statistic); } return answer; } static toInventoriesDictionary(inventories) { if (inventories == null) return null; let answer = new Map(); for (let i = 0; i < inventories.length; i++) { let inventory = inventories[i]; answer.set(inventory.itemId, inventory); } return answer; } static toGroupDictionary(groups) { if (groups == null) return null; let answer = new Map(); for (let i = 0; i < groups.length; i++) { let group = groups[i]; answer.set(group.groupId, group); } return answer; } static toFriendDictionary(friends) { if (friends == null) return null; let answer = new Map(); for (let i = 0; i < friends.length; i++) { let friend = friends[i]; answer.set(friend.friendId, friend); } return answer; } }