@ptolemy2002/js-math-utils 2.0.0 → 2.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/README.md CHANGED
@@ -9,6 +9,14 @@ import { functionName } from '@ptolemy2002/js-math-utils';
9
9
  const { functionName } = require('@ptolemy2002/js-math-utils');
10
10
  ```
11
11
 
12
+ ## Type Reference
13
+ ```typescript
14
+ type ClampOptions = {
15
+ min?: number;
16
+ max?: number;
17
+ };
18
+ ```
19
+
12
20
  ## Functions
13
21
  The following functions are available in the library:
14
22
 
@@ -17,27 +25,25 @@ The following functions are available in the library:
17
25
  Clamps a number between a minimum and maximum value.
18
26
 
19
27
  #### Parameters
20
- - `value` (Number): The value to be clamped.
21
- - `min` (Number): The minimum value.
22
- - `max` (Number): The maximum value.
28
+ - `value` (`number`): The value to be clamped.
29
+ - `args` - An object containing the following properties:
30
+ - `min` (`number?`): The minimum value. If not specified, the value is not clamped on the minimum side.
31
+ - `max` (`number?`): The maximum value. If not specified, the value is not clamped on the maximum side.
23
32
 
24
33
  #### Returns
25
- Number - The clamped value.
34
+ `number` - The clamped value.
26
35
 
27
36
  ### wrapNumber
28
37
  #### Description
29
38
  Wraps a number between a minimum and maximum value, non-inclusive on the maximum side (so `min - 1` gets converted to `max - 1` and `max` gets converted to `min`).
30
39
 
31
40
  #### Parameters
32
- - `n` (Number): The number to be wrapped.
33
- - `min` (Number): The minimum value.
34
- - `max` (Number): The maximum value.
41
+ - `n` (`number`): The number to be wrapped.
42
+ - `min` (`number`): The minimum value.
43
+ - `max` (`number`): The maximum value.
35
44
 
36
45
  #### Returns
37
- Number - The wrapped value.
38
-
39
- ## Meta
40
- This is a React Library Created by Ptolemy2002's [cra-template-react-library](https://www.npmjs.com/package/@ptolemy2002/cra-template-react-library) template in combination with [create-react-app](https://www.npmjs.com/package/create-react-app). However, it does not actually depend on React - it has been modified to work only with my own utility library. It contains methods of building and publishing your library to npm.
46
+ `number` - The wrapped value.
41
47
 
42
48
  ## Peer Dependencies
43
49
  This project does not have any peer dependencies (they are all bundled with the library), so it should work out of the box.
package/dist/index.d.ts CHANGED
@@ -1,7 +1,6 @@
1
- type ClampOptions = {
1
+ export type ClampOptions = {
2
2
  min?: number;
3
3
  max?: number;
4
4
  };
5
5
  export declare function clamp(value: number, { min, max }?: ClampOptions): number;
6
6
  export declare function wrapNumber(n: number, min: number, max: number): number;
7
- export {};
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@ptolemy2002/js-math-utils",
3
- "version": "2.0.0",
3
+ "version": "2.0.1",
4
4
  "private": false,
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",