@theholocron/misc-utils 1.0.1 → 1.0.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.
Files changed (2) hide show
  1. package/README.md +33 -4
  2. package/package.json +4 -4
package/README.md CHANGED
@@ -1,11 +1,40 @@
1
- # Miscellaneous
1
+ # `@theholocron/misc-utils`
2
2
 
3
- Miscellaneous utilities.
3
+ Miscellaneous browser utilities.
4
4
 
5
5
  ## Installation
6
6
 
7
7
  ```bash
8
- npm install --save-dev @theholocron/utils-misc
8
+ pnpm add @theholocron/misc-utils
9
9
  ```
10
10
 
11
- Check out [The Holocron Archive](https://docs.theholocron.dev/projects/utilities/) for more information.
11
+ ## Usage
12
+
13
+ ### Konami code detector
14
+
15
+ ```typescript
16
+ import { konami } from "@theholocron/misc-utils";
17
+
18
+ // The classic sequence: ↑ ↑ ↓ ↓ ← → ← → B A
19
+ console.log(konami.CODE);
20
+ // ["ArrowUp", "ArrowUp", "ArrowDown", "ArrowDown",
21
+ // "ArrowLeft", "ArrowRight", "ArrowLeft", "ArrowRight", "KeyB", "KeyA"]
22
+
23
+ window.addEventListener("keydown", (event) => {
24
+ if (konami.is(event)) {
25
+ console.log("Konami code entered!");
26
+ }
27
+ });
28
+ ```
29
+
30
+ ### `konami.is(event)`
31
+
32
+ Checks whether the given `KeyboardEvent` continues the Konami code sequence. Returns `true` when the full sequence is completed; resets the internal index on any incorrect key.
33
+
34
+ ### `konami.CODE`
35
+
36
+ The Konami code sequence as a readonly `TKonamiCode[]`.
37
+
38
+ ## Documentation
39
+
40
+ Check out [The Holocron Archive](https://docs.theholocron.dev/projects/utils/) for more information.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@theholocron/misc-utils",
3
- "version": "1.0.1",
3
+ "version": "1.0.6",
4
4
  "description": "Miscellaneous utilities.",
5
5
  "homepage": "https://github.com/theholocron/utils/tree/main/packages/utils-misc#readme",
6
6
  "bugs": "https://github.com/theholocron/utils/issues",
@@ -22,11 +22,11 @@
22
22
  "README.md"
23
23
  ],
24
24
  "devDependencies": {
25
- "@theholocron/tsdown-config": "^7.5.0",
26
- "@theholocron/vitest-config": "^7.5.0",
25
+ "@theholocron/tsdown-config": "^7.6.1",
26
+ "@theholocron/vitest-config": "^7.6.1",
27
27
  "@tsconfig/node-lts": "^24.0.0",
28
28
  "@vitest/coverage-v8": "^4.1.10",
29
- "tsdown": "^0.22.13",
29
+ "tsdown": "^0.22.14",
30
30
  "vitest": "^4.1.10"
31
31
  },
32
32
  "engines": {