tiny-math-kit 1.0.0 → 1.0.1
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/package.json +12 -3
- package/readme.md +23 -0
package/package.json
CHANGED
|
@@ -1,13 +1,22 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "tiny-math-kit",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Basic math functions for JavaScript.",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "commonjs",
|
|
7
7
|
"license": "MIT",
|
|
8
8
|
"author": "chrjs",
|
|
9
|
-
"keywords": [
|
|
9
|
+
"keywords": [
|
|
10
|
+
"math",
|
|
11
|
+
"calculator",
|
|
12
|
+
"arithmetic",
|
|
13
|
+
"numbers",
|
|
14
|
+
"utils"
|
|
15
|
+
],
|
|
10
16
|
"scripts": {
|
|
11
17
|
"test": "node index.js"
|
|
18
|
+
},
|
|
19
|
+
"dependencies": {
|
|
20
|
+
"tiny-math-kit": "^1.0.0"
|
|
12
21
|
}
|
|
13
|
-
}
|
|
22
|
+
}
|
package/readme.md
ADDED
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
# tiny-math-kit
|
|
2
|
+
|
|
3
|
+
A simple and lightweight JavaScript math utility library designed to provide useful and fast math helper functions for everyday development.
|
|
4
|
+
|
|
5
|
+
It is easy to install, dependency-free, and works in any Node.js project.
|
|
6
|
+
|
|
7
|
+
---
|
|
8
|
+
|
|
9
|
+
## Installation
|
|
10
|
+
|
|
11
|
+
```bash
|
|
12
|
+
npm install tiny-math-kit
|
|
13
|
+
|
|
14
|
+
# Usage
|
|
15
|
+
|
|
16
|
+
const math = require("tiny-math-kit");
|
|
17
|
+
|
|
18
|
+
console.log(math.clamp(15, 0, 10)); // 10
|
|
19
|
+
console.log(math.percent(50, 200)); // 25
|
|
20
|
+
console.log(math.lerp(0, 100, 0.5)); // 50
|
|
21
|
+
console.log(math.normalize(5, 0, 10)); // 0.5
|
|
22
|
+
console.log(math.map(5, 0, 10, 0, 100)); // 50
|
|
23
|
+
console.log(math.randomRange(1, 10)); // random number
|