warcraft-3-w3ts-utils 0.1.10 → 0.1.11

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/dist/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warcraft-3-w3ts-utils",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "A library of utility functions for modding Warcraft 3 utilizing the W3TS template.",
5
5
  "main": "./src/index.ts",
6
6
  "keywords": [
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "warcraft-3-w3ts-utils",
3
- "version": "0.1.10",
3
+ "version": "0.1.11",
4
4
  "description": "A library of utility functions for modding Warcraft 3 utilizing the W3TS template.",
5
5
  "main": "./src/index.ts",
6
6
  "keywords": [
package/readme.md ADDED
@@ -0,0 +1,68 @@
1
+ # WC3-W3TS-utils
2
+
3
+ Small collection of utility helpers for projects using W3TS (Warcraft III TypeScript, v3.x). Designed to be lightweight and easy to drop into your WC3 TypeScript projects to simplify common tasks (tables, math, cloning, timers, safe wrappers, etc.).
4
+
5
+ ## Features
6
+ - Safe wrappers for native WC3 APIs
7
+ - Common math and clamp helpers
8
+ - Table/object deep clone and merge
9
+ - Timer helpers and simple schedulers
10
+ - Small, dependency-free TypeScript utilities
11
+
12
+ ## Installation
13
+ Copy the utils folder into your project or install via your package manager if published:
14
+
15
+ npm
16
+ ```
17
+ npm install wc3-w3ts-utils
18
+ ```
19
+
20
+ yarn
21
+ ```
22
+ yarn add wc3-w3ts-utils
23
+ ```
24
+
25
+ Or add the files directly to your W3TS project (recommended for custom Warcraft builds).
26
+
27
+ ## Usage
28
+ Import only what you need:
29
+
30
+ ```ts
31
+ import { clamp, deepClone, createTimer } from 'wc3-w3ts-utils';
32
+
33
+ // clamp example
34
+ const v = clamp(10, 0, 5); // 5
35
+
36
+ // deep clone example
37
+ const copy = deepClone(original);
38
+
39
+ // timer example
40
+ const t = createTimer(() => {
41
+ // do something each tick
42
+ }, 1.0, true);
43
+ ```
44
+
45
+ If copied directly into a W3TS project, adjust import paths accordingly:
46
+ ```ts
47
+ import { clamp } from './utils/math';
48
+ ```
49
+
50
+ ## API (examples)
51
+ - clamp(value: number, min: number, max: number): number
52
+ - deepClone<T>(obj: T): T
53
+ - merge<T>(target: T, source: Partial<T>): T
54
+ - createTimer(callback: () => void, period: number, repeating?: boolean)
55
+ - safeCall<T>(fn: () => T, fallback?: T): T
56
+
57
+ (See source files for full signatures and docs.)
58
+
59
+ ## Contributing
60
+ - Open an issue for bugs or enhancement requests.
61
+ - Fork, create a feature branch, and submit a PR with tests/examples where applicable.
62
+ - Keep changes small and well-documented.
63
+
64
+ ## License
65
+ MIT — see LICENSE file.
66
+
67
+ ## Notes
68
+ Built to be simple and compatible with W3TS v3.x and Warcraft III modding workflows. Adjust imports when integrating directly into your map project.