lol-constants 2.5.0 → 2.6.0
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/README.md +7 -9
- package/core/constants/DataDragonUrls.d.ts +2 -0
- package/core/constants/DataDragonUrls.js +2 -0
- package/core/constants/QueueDescriptions.d.ts +21 -0
- package/core/constants/QueueDescriptions.js +26 -0
- package/core/index.d.ts +2 -0
- package/core/index.js +2 -0
- package/package.json +1 -1
package/README.md
CHANGED
@@ -1,16 +1,14 @@
|
|
1
|
-
Provides constants and types for League of Legends related stuff within the context of [Riot APIs](https://developer.riotgames.com/docs/lol). Types such as [ChampionId](
|
1
|
+
Provides constants and types for League of Legends related stuff within the context of [Riot APIs](https://developer.riotgames.com/docs/lol). Types such as [`ChampionId`](src/core/constants/Champions/ChampionIds.ts), [`ChampionName`](src/core/constants/Champions/ChampionNames.ts), [`ItemKey`](src/core/constants/Items/ItemKeys.ts), [`RuneId`](src/core/constants/Runes/RuneSetsByRuneNames.ts#L55), [`SpellName`](src/core/constants/Spells/SpellNames.ts), [`Position`](src/core/constants/Positions.ts), [`Queue`](src/core/constants/Queues.ts), [`RankedTier`](src/core/constants/RankedTiers.ts), [`Region`](src/core/constants/Regions.ts) and more are provided. Certain URLs and URIs are available as constants as well in [`DataDragonUrls`](src/core/constants/DataDragonUrls.ts), [`PlatformApiUris`](src/core/constants/PlatformApiUris.ts), [`RegionalApiUris`](src/core/constants/RegionalApiUris.ts).
|
2
2
|
|
3
3
|
Advantages:
|
4
|
-
- Four categories — champions, items, runes, summoner spells — are armed with getter functions that exchange between id–key–name such as [getChampionNameByKey](
|
5
|
-
- Types can be validated through type
|
6
|
-
- Type validation functions such as [isChampionName](
|
7
|
-
|
8
|
-
<!-- - Runes and items are also provided in a categorized way: [StatRuneId](asd), [NonStatRuneId](asd), [DominationRuneId](asd) etc. and [MythicItemName](asd), [LegendaryItemName](asd), [BootsItemName](asd) etc. -->
|
4
|
+
- Four categories — champions, items, runes, summoner spells — are armed with getter functions that exchange between id–key–name such as [`getChampionNameByKey`](src/core/helpers/Champions/getChampionNameByKey.ts)–[`getChampionIdByName`](src/core/helpers/Champions/getChampionIdByName.ts)–[`getChampionKeyById`](src/core/helpers/Champions/getChampionKeyById.ts)
|
5
|
+
- Types can be validated through type-validating functions such as [`isChampionName`](src/core/helpers/Champions/isChampionName.ts)
|
6
|
+
- Type validation functions such as [`isChampionName`](src/core/helpers/Champions/isChampionName.ts) and getter functions such as [`getChampionNameByKey`](src/core/helpers/Champions/getChampionNameByKey.ts) are instantaneous $O(1)$ and do not iterate over many elements
|
9
7
|
|
10
8
|
# Champions
|
11
|
-
| constants | types | getters
|
12
|
-
| --- | --- |
|
13
|
-
| `ChampionIds`, `ChampionKeys` | `ChampionId`, `ChampionKey`, `ChampionKeyNum`, `ChampionName` |
|
9
|
+
| constants | types | getters | type-validators
|
10
|
+
| --- | --- | --- | --- |
|
11
|
+
| `ChampionIds`, `ChampionIdsByName`, `ChampionKeys`, `ChampionKeysNum`, `ChampionNames` | `ChampionId`, `ChampionKey`, `ChampionKeyNum`, `ChampionName` | `getChampionIdByKey`, `getChampionIdByName`, `getChampionKeyById`, `getChampionKeyByName`, `getChampionNameById`, `getChampionNameByKey` | `isChampionId`, `isChampionKey`, `isChampionKeyNum`, `isChampionName`
|
14
12
|
# Items
|
15
13
|
# Runes
|
16
14
|
# Summoner spells
|
@@ -0,0 +1,21 @@
|
|
1
|
+
export declare const QueueDescriptions: {
|
2
|
+
readonly 0: "Custom";
|
3
|
+
readonly 400: "5v5 Draft Pick";
|
4
|
+
readonly 420: "5v5 Ranked Solo";
|
5
|
+
readonly 430: "5v5 Blind Pick";
|
6
|
+
readonly 440: "5v5 Ranked Flex";
|
7
|
+
readonly 450: "5v5 ARAM";
|
8
|
+
readonly 700: "Clash";
|
9
|
+
readonly 900: "ARURF";
|
10
|
+
readonly 920: "Legend of the Poro King";
|
11
|
+
readonly 1020: "One for All";
|
12
|
+
readonly 1090: "Teamfight Tactics";
|
13
|
+
readonly 1100: "Ranked Teamfight Tactics";
|
14
|
+
readonly 1110: "Teamfight Tactics Tutorial";
|
15
|
+
readonly 1111: "Teamfight Tactics test";
|
16
|
+
readonly 1300: "Nexus Blitz";
|
17
|
+
readonly 1400: "Ultimate Spellbook";
|
18
|
+
readonly 1900: "URF";
|
19
|
+
};
|
20
|
+
export type QueueDescription = typeof QueueDescriptions[keyof typeof QueueDescriptions];
|
21
|
+
export declare function isQueueDescription(value: any): value is QueueDescription;
|
@@ -0,0 +1,26 @@
|
|
1
|
+
"use strict";
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
3
|
+
exports.isQueueDescription = exports.QueueDescriptions = void 0;
|
4
|
+
exports.QueueDescriptions = {
|
5
|
+
0: 'Custom',
|
6
|
+
400: '5v5 Draft Pick',
|
7
|
+
420: '5v5 Ranked Solo',
|
8
|
+
430: '5v5 Blind Pick',
|
9
|
+
440: '5v5 Ranked Flex',
|
10
|
+
450: '5v5 ARAM',
|
11
|
+
700: 'Clash',
|
12
|
+
900: 'ARURF',
|
13
|
+
920: 'Legend of the Poro King',
|
14
|
+
1020: 'One for All',
|
15
|
+
1090: 'Teamfight Tactics',
|
16
|
+
1100: 'Ranked Teamfight Tactics',
|
17
|
+
1110: 'Teamfight Tactics Tutorial',
|
18
|
+
1111: 'Teamfight Tactics test',
|
19
|
+
1300: 'Nexus Blitz',
|
20
|
+
1400: 'Ultimate Spellbook',
|
21
|
+
1900: 'URF',
|
22
|
+
};
|
23
|
+
function isQueueDescription(value) {
|
24
|
+
return typeof value == 'string' && value in exports.QueueDescriptions;
|
25
|
+
}
|
26
|
+
exports.isQueueDescription = isQueueDescription;
|
package/core/index.d.ts
CHANGED
@@ -13,6 +13,8 @@ export * from './constants/MonsterTypes';
|
|
13
13
|
export * from './constants/PlatformApiUris';
|
14
14
|
export * from './constants/PlatformIds';
|
15
15
|
export * from './constants/Positions';
|
16
|
+
export * from './constants/QueueDescriptions';
|
17
|
+
export * from './constants/QueueIds';
|
16
18
|
export * from './constants/Queues';
|
17
19
|
export * from './constants/RankedRanks';
|
18
20
|
export * from './constants/RankedTiers';
|
package/core/index.js
CHANGED
@@ -30,6 +30,8 @@ __exportStar(require("./constants/MonsterTypes"), exports);
|
|
30
30
|
__exportStar(require("./constants/PlatformApiUris"), exports);
|
31
31
|
__exportStar(require("./constants/PlatformIds"), exports);
|
32
32
|
__exportStar(require("./constants/Positions"), exports);
|
33
|
+
__exportStar(require("./constants/QueueDescriptions"), exports);
|
34
|
+
__exportStar(require("./constants/QueueIds"), exports);
|
33
35
|
__exportStar(require("./constants/Queues"), exports);
|
34
36
|
__exportStar(require("./constants/RankedRanks"), exports);
|
35
37
|
__exportStar(require("./constants/RankedTiers"), exports);
|
package/package.json
CHANGED