@inglorious/utils 3.7.1 → 3.7.2
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 +86 -86
- package/package.json +5 -5
package/README.md
CHANGED
|
@@ -1,86 +1,86 @@
|
|
|
1
|
-
# Inglorious Utils
|
|
2
|
-
|
|
3
|
-
[](https://www.npmjs.com/package/@inglorious/utils)
|
|
4
|
-
[](https://opensource.org/licenses/MIT)
|
|
5
|
-
|
|
6
|
-
A set of general-purpose utility functions designed with functional programming principles in mind. This package is part of the [Inglorious Forge](https://github.com/IngloriousCoderz/inglorious-forge) monorepo.
|
|
7
|
-
|
|
8
|
-
---
|
|
9
|
-
|
|
10
|
-
## Overview
|
|
11
|
-
|
|
12
|
-
This package provides a collection of pure, composable helper functions to streamline development in any JavaScript or TypeScript project. It embraces a data-oriented and functional approach, operating on plain data structures like objects and arrays.
|
|
13
|
-
|
|
14
|
-
---
|
|
15
|
-
|
|
16
|
-
## Installation
|
|
17
|
-
|
|
18
|
-
```bash
|
|
19
|
-
npm install @inglorious/utils
|
|
20
|
-
```
|
|
21
|
-
|
|
22
|
-
---
|
|
23
|
-
|
|
24
|
-
## Usage
|
|
25
|
-
|
|
26
|
-
Here are a few examples of how you can use the utilities in this package.
|
|
27
|
-
|
|
28
|
-
### `pipe`
|
|
29
|
-
|
|
30
|
-
Compose functions together in a readable, left-to-right sequence.
|
|
31
|
-
|
|
32
|
-
```javascript
|
|
33
|
-
import { pipe } from "@inglorious/utils/functions/functions"
|
|
34
|
-
|
|
35
|
-
const add = (a) => (b) => a + b
|
|
36
|
-
const multiply = (a) => (b) => a * b
|
|
37
|
-
|
|
38
|
-
const calculate = pipe(
|
|
39
|
-
add(5), // 10 + 5 = 15
|
|
40
|
-
multiply(2), // 15 * 2 = 30
|
|
41
|
-
add(10), // 30 + 10 = 40
|
|
42
|
-
)
|
|
43
|
-
|
|
44
|
-
const result = calculate(10) // 40
|
|
45
|
-
```
|
|
46
|
-
|
|
47
|
-
### Vector Math
|
|
48
|
-
|
|
49
|
-
Perform vector operations on plain objects.
|
|
50
|
-
|
|
51
|
-
```javascript
|
|
52
|
-
import { add } from "@inglorious/utils/math/vector.js"
|
|
53
|
-
|
|
54
|
-
const position = [10, 20]
|
|
55
|
-
const velocity = [2, -1]
|
|
56
|
-
|
|
57
|
-
const newPosition = add(position, velocity)
|
|
58
|
-
// => [12, 19]
|
|
59
|
-
```
|
|
60
|
-
|
|
61
|
-
---
|
|
62
|
-
|
|
63
|
-
## API
|
|
64
|
-
|
|
65
|
-
This package is designed to be used with subpath imports, which helps with tree-shaking.
|
|
66
|
-
|
|
67
|
-
- **`@inglorious/utils/algorithms`**: Utilities for AI algorithms, like decision trees and A\*.
|
|
68
|
-
- **`@inglorious/utils/functions`**: Utilities for function composition.
|
|
69
|
-
- **`@inglorious/utils/math`**: Utilities for math operations.
|
|
70
|
-
- **`@inglorious/utils/physics`**: Utilities for calculations on friction, acceleration, and gravity.
|
|
71
|
-
|
|
72
|
-
---
|
|
73
|
-
|
|
74
|
-
## License
|
|
75
|
-
|
|
76
|
-
**MIT License - Free and open source**
|
|
77
|
-
|
|
78
|
-
Created by [Matteo Antony Mistretta](https://github.com/IngloriousCoderz)
|
|
79
|
-
|
|
80
|
-
You're free to use, modify, and distribute this software. See [LICENSE](./LICENSE) for details.
|
|
81
|
-
|
|
82
|
-
---
|
|
83
|
-
|
|
84
|
-
## Contributing
|
|
85
|
-
|
|
86
|
-
We welcome contributions! Please see the root `CONTRIBUTING.md` file for more details.
|
|
1
|
+
# Inglorious Utils
|
|
2
|
+
|
|
3
|
+
[](https://www.npmjs.com/package/@inglorious/utils)
|
|
4
|
+
[](https://opensource.org/licenses/MIT)
|
|
5
|
+
|
|
6
|
+
A set of general-purpose utility functions designed with functional programming principles in mind. This package is part of the [Inglorious Forge](https://github.com/IngloriousCoderz/inglorious-forge) monorepo.
|
|
7
|
+
|
|
8
|
+
---
|
|
9
|
+
|
|
10
|
+
## Overview
|
|
11
|
+
|
|
12
|
+
This package provides a collection of pure, composable helper functions to streamline development in any JavaScript or TypeScript project. It embraces a data-oriented and functional approach, operating on plain data structures like objects and arrays.
|
|
13
|
+
|
|
14
|
+
---
|
|
15
|
+
|
|
16
|
+
## Installation
|
|
17
|
+
|
|
18
|
+
```bash
|
|
19
|
+
npm install @inglorious/utils
|
|
20
|
+
```
|
|
21
|
+
|
|
22
|
+
---
|
|
23
|
+
|
|
24
|
+
## Usage
|
|
25
|
+
|
|
26
|
+
Here are a few examples of how you can use the utilities in this package.
|
|
27
|
+
|
|
28
|
+
### `pipe`
|
|
29
|
+
|
|
30
|
+
Compose functions together in a readable, left-to-right sequence.
|
|
31
|
+
|
|
32
|
+
```javascript
|
|
33
|
+
import { pipe } from "@inglorious/utils/functions/functions"
|
|
34
|
+
|
|
35
|
+
const add = (a) => (b) => a + b
|
|
36
|
+
const multiply = (a) => (b) => a * b
|
|
37
|
+
|
|
38
|
+
const calculate = pipe(
|
|
39
|
+
add(5), // 10 + 5 = 15
|
|
40
|
+
multiply(2), // 15 * 2 = 30
|
|
41
|
+
add(10), // 30 + 10 = 40
|
|
42
|
+
)
|
|
43
|
+
|
|
44
|
+
const result = calculate(10) // 40
|
|
45
|
+
```
|
|
46
|
+
|
|
47
|
+
### Vector Math
|
|
48
|
+
|
|
49
|
+
Perform vector operations on plain objects.
|
|
50
|
+
|
|
51
|
+
```javascript
|
|
52
|
+
import { add } from "@inglorious/utils/math/vector.js"
|
|
53
|
+
|
|
54
|
+
const position = [10, 20]
|
|
55
|
+
const velocity = [2, -1]
|
|
56
|
+
|
|
57
|
+
const newPosition = add(position, velocity)
|
|
58
|
+
// => [12, 19]
|
|
59
|
+
```
|
|
60
|
+
|
|
61
|
+
---
|
|
62
|
+
|
|
63
|
+
## API
|
|
64
|
+
|
|
65
|
+
This package is designed to be used with subpath imports, which helps with tree-shaking.
|
|
66
|
+
|
|
67
|
+
- **`@inglorious/utils/algorithms`**: Utilities for AI algorithms, like decision trees and A\*.
|
|
68
|
+
- **`@inglorious/utils/functions`**: Utilities for function composition.
|
|
69
|
+
- **`@inglorious/utils/math`**: Utilities for math operations.
|
|
70
|
+
- **`@inglorious/utils/physics`**: Utilities for calculations on friction, acceleration, and gravity.
|
|
71
|
+
|
|
72
|
+
---
|
|
73
|
+
|
|
74
|
+
## License
|
|
75
|
+
|
|
76
|
+
**MIT License - Free and open source**
|
|
77
|
+
|
|
78
|
+
Created by [Matteo Antony Mistretta](https://github.com/IngloriousCoderz)
|
|
79
|
+
|
|
80
|
+
You're free to use, modify, and distribute this software. See [LICENSE](./LICENSE) for details.
|
|
81
|
+
|
|
82
|
+
---
|
|
83
|
+
|
|
84
|
+
## Contributing
|
|
85
|
+
|
|
86
|
+
We welcome contributions! Please see the root `CONTRIBUTING.md` file for more details.
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@inglorious/utils",
|
|
3
|
-
"version": "3.7.
|
|
3
|
+
"version": "3.7.2",
|
|
4
4
|
"description": "A set of general-purpose utility functions designed with functional programming principles in mind.",
|
|
5
5
|
"author": "IceOnFire <antony.mistretta@gmail.com> (https://ingloriouscoderz.it)",
|
|
6
6
|
"license": "MIT",
|
|
@@ -33,8 +33,8 @@
|
|
|
33
33
|
},
|
|
34
34
|
"files": [
|
|
35
35
|
"src",
|
|
36
|
-
"
|
|
37
|
-
"
|
|
36
|
+
"types",
|
|
37
|
+
"!src/**/*.test.js"
|
|
38
38
|
],
|
|
39
39
|
"publishConfig": {
|
|
40
40
|
"access": "public"
|
|
@@ -49,8 +49,8 @@
|
|
|
49
49
|
"node": ">= 22"
|
|
50
50
|
},
|
|
51
51
|
"scripts": {
|
|
52
|
-
"format": "prettier --write
|
|
53
|
-
"lint": "eslint .
|
|
52
|
+
"format": "prettier --write .",
|
|
53
|
+
"lint": "eslint .",
|
|
54
54
|
"test:watch": "vitest",
|
|
55
55
|
"test": "vitest run"
|
|
56
56
|
}
|