@kevlid/discordmenus 0.1.5 → 0.1.6
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 +2 -0
- package/index.d.ts +1 -1
- package/package.json +2 -9
- package/src/utils/formatKey.js +4 -16
package/README.md
CHANGED
package/index.d.ts
CHANGED
|
@@ -265,5 +265,5 @@ export declare function fromDiscordJS(interaction: DiscordInteraction): DiscordI
|
|
|
265
265
|
|
|
266
266
|
/** Encode option/menu keys for custom IDs (uppercase → _lowercase, spaces → _). */
|
|
267
267
|
export declare function formatKey(key: string): string;
|
|
268
|
-
/**
|
|
268
|
+
/** No-op: casing is not reconstructed anywhere. */
|
|
269
269
|
export declare function decodeKey(encoded: string): string;
|
package/package.json
CHANGED
|
@@ -1,18 +1,11 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@kevlid/discordmenus",
|
|
3
|
-
"version": "0.1.
|
|
4
|
-
"description": "
|
|
3
|
+
"version": "0.1.6",
|
|
4
|
+
"description": "some menu stuff for discord stuff",
|
|
5
5
|
"main": "src/index.js",
|
|
6
6
|
"types": "index.d.ts",
|
|
7
7
|
"author": "kevlid",
|
|
8
8
|
"license": "ISC",
|
|
9
|
-
"keywords": [
|
|
10
|
-
"discord",
|
|
11
|
-
"discord.js",
|
|
12
|
-
"menu",
|
|
13
|
-
"typescript",
|
|
14
|
-
"builder"
|
|
15
|
-
],
|
|
16
9
|
"files": [
|
|
17
10
|
"src",
|
|
18
11
|
"index.d.ts",
|
package/src/utils/formatKey.js
CHANGED
|
@@ -19,25 +19,13 @@ function formatKey(key) {
|
|
|
19
19
|
}
|
|
20
20
|
|
|
21
21
|
/**
|
|
22
|
-
*
|
|
23
|
-
*
|
|
22
|
+
* NOTE: decodeKey is intentionally a no-op.
|
|
23
|
+
* Keys are encoded with `formatKey()` for stability in custom IDs, and we do not attempt to
|
|
24
|
+
* reconstruct original casing anywhere (including get/save contexts).
|
|
24
25
|
*/
|
|
25
26
|
function decodeKey(encoded) {
|
|
26
27
|
if (typeof encoded !== "string") throw new TypeError("Key must be a string");
|
|
27
|
-
|
|
28
|
-
for (let i = 0; i < encoded.length; i++) {
|
|
29
|
-
const c = encoded[i];
|
|
30
|
-
if (c === "_" && i + 1 < encoded.length) {
|
|
31
|
-
const next = encoded[i + 1];
|
|
32
|
-
if (next >= "a" && next <= "z") {
|
|
33
|
-
out += next.toUpperCase();
|
|
34
|
-
i++;
|
|
35
|
-
continue;
|
|
36
|
-
}
|
|
37
|
-
}
|
|
38
|
-
out += c;
|
|
39
|
-
}
|
|
40
|
-
return out;
|
|
28
|
+
return String(encoded);
|
|
41
29
|
}
|
|
42
30
|
|
|
43
31
|
module.exports = {
|