@library/math 0.0.7 → 0.0.8
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.
|
@@ -79,7 +79,9 @@
|
|
|
79
79
|
<a name='L14'></a><a href='#L14'>14</a>
|
|
80
80
|
<a name='L15'></a><a href='#L15'>15</a>
|
|
81
81
|
<a name='L16'></a><a href='#L16'>16</a>
|
|
82
|
-
<a name='L17'></a><a href='#L17'>17</a
|
|
82
|
+
<a name='L17'></a><a href='#L17'>17</a>
|
|
83
|
+
<a name='L18'></a><a href='#L18'>18</a></td><td class="line-coverage quiet"><span class="cline-any cline-neutral"> </span>
|
|
84
|
+
<span class="cline-any cline-neutral"> </span>
|
|
83
85
|
<span class="cline-any cline-neutral"> </span>
|
|
84
86
|
<span class="cline-any cline-neutral"> </span>
|
|
85
87
|
<span class="cline-any cline-neutral"> </span>
|
|
@@ -96,6 +98,7 @@
|
|
|
96
98
|
<span class="cline-any cline-yes">5x</span>
|
|
97
99
|
<span class="cline-any cline-neutral"> </span>
|
|
98
100
|
<span class="cline-any cline-neutral"> </span></td><td class="text"><pre class="prettyprint lang-js">/**
|
|
101
|
+
* Clamp a number between a lower and upper bound.
|
|
99
102
|
* @param {number} value The number to clamp.
|
|
100
103
|
* @param {number} min The lower bound.
|
|
101
104
|
* @param {number} max The upper bound.
|
|
@@ -118,7 +121,7 @@ export function clamp(value: number, min: number, max: number): number {
|
|
|
118
121
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
119
122
|
Code coverage generated by
|
|
120
123
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
121
|
-
at 2026-10-
|
|
124
|
+
at 2026-10-09T09:53:06.282Z
|
|
122
125
|
</div>
|
|
123
126
|
<script src="prettify.js"></script>
|
|
124
127
|
<script>
|
|
@@ -116,7 +116,7 @@
|
|
|
116
116
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
117
117
|
Code coverage generated by
|
|
118
118
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
119
|
-
at 2026-10-
|
|
119
|
+
at 2026-10-09T09:53:06.282Z
|
|
120
120
|
</div>
|
|
121
121
|
<script src="prettify.js"></script>
|
|
122
122
|
<script>
|
|
@@ -73,7 +73,7 @@
|
|
|
73
73
|
<div class='footer quiet pad2 space-top1 center small'>
|
|
74
74
|
Code coverage generated by
|
|
75
75
|
<a href="https://istanbul.js.org/" target="_blank" rel="noopener noreferrer">istanbul</a>
|
|
76
|
-
at 2026-10-
|
|
76
|
+
at 2026-10-09T09:53:06.282Z
|
|
77
77
|
</div>
|
|
78
78
|
<script src="prettify.js"></script>
|
|
79
79
|
<script>
|
package/coverage/lcov.info
CHANGED
package/llms.txt
ADDED
|
@@ -0,0 +1,42 @@
|
|
|
1
|
+
<!-- Generated by `yarn docs`. Do not edit by hand. -->
|
|
2
|
+
# @library/math
|
|
3
|
+
|
|
4
|
+
> A collection of math utilities for TypeScript.
|
|
5
|
+
|
|
6
|
+
Install:
|
|
7
|
+
|
|
8
|
+
```console
|
|
9
|
+
npm install @library/math
|
|
10
|
+
```
|
|
11
|
+
|
|
12
|
+
All exports are named ESM/CJS exports, importable as:
|
|
13
|
+
|
|
14
|
+
```ts
|
|
15
|
+
import { clamp } from "@library/math";
|
|
16
|
+
```
|
|
17
|
+
|
|
18
|
+
## API
|
|
19
|
+
|
|
20
|
+
### clamp
|
|
21
|
+
|
|
22
|
+
Clamp a number between a lower and upper bound.
|
|
23
|
+
|
|
24
|
+
```ts
|
|
25
|
+
function clamp(value: number, min: number, max: number): number
|
|
26
|
+
```
|
|
27
|
+
|
|
28
|
+
Parameters:
|
|
29
|
+
|
|
30
|
+
- `value`: The number to clamp.
|
|
31
|
+
- `min`: The lower bound.
|
|
32
|
+
- `max`: The upper bound.
|
|
33
|
+
|
|
34
|
+
Returns: The clamped number.
|
|
35
|
+
|
|
36
|
+
Example:
|
|
37
|
+
|
|
38
|
+
```ts
|
|
39
|
+
clamp(5, 0, 10); // 5
|
|
40
|
+
clamp(-5, 0, 10); // 0
|
|
41
|
+
clamp(15, 0, 10); // 10
|
|
42
|
+
```
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@library/math",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.8",
|
|
4
4
|
"description": "A collection of math utilities for TypeScript.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/cjs/index.cjs",
|
|
@@ -40,5 +40,5 @@
|
|
|
40
40
|
"publishConfig": {
|
|
41
41
|
"access": "public"
|
|
42
42
|
},
|
|
43
|
-
"gitHead": "
|
|
43
|
+
"gitHead": "fea3f714ec98af5ce58621c53734e44a62f881df"
|
|
44
44
|
}
|