@inglorious/utils 3.7.1 → 3.7.3
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/LICENSE +9 -9
- package/README.md +86 -86
- package/package.json +7 -6
package/LICENSE
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
The MIT License (MIT)
|
|
2
|
-
|
|
3
|
-
Copyright © 2025 Inglorious Coderz Srl.
|
|
4
|
-
|
|
5
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
-
|
|
7
|
-
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
-
|
|
9
|
-
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
|
1
|
+
The MIT License (MIT)
|
|
2
|
+
|
|
3
|
+
Copyright © 2025 Inglorious Coderz Srl.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the “Software”), to deal in the Software without restriction, including without limitation the rights to use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of the Software, and to permit persons to whom the Software is furnished to do so, subject to the following conditions:
|
|
6
|
+
|
|
7
|
+
The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.
|
|
8
|
+
|
|
9
|
+
THE SOFTWARE IS PROVIDED “AS IS”, WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.
|
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.3",
|
|
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,24 +33,25 @@
|
|
|
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"
|
|
41
41
|
},
|
|
42
|
+
"sideEffects": false,
|
|
42
43
|
"devDependencies": {
|
|
43
44
|
"prettier": "^3.6.2",
|
|
44
45
|
"vite": "^7.1.3",
|
|
45
46
|
"vitest": "^1.6.1",
|
|
46
|
-
"@inglorious/eslint-config": "1.1.
|
|
47
|
+
"@inglorious/eslint-config": "1.1.2"
|
|
47
48
|
},
|
|
48
49
|
"engines": {
|
|
49
50
|
"node": ">= 22"
|
|
50
51
|
},
|
|
51
52
|
"scripts": {
|
|
52
|
-
"format": "prettier --write
|
|
53
|
-
"lint": "eslint .
|
|
53
|
+
"format": "prettier --write .",
|
|
54
|
+
"lint": "eslint .",
|
|
54
55
|
"test:watch": "vitest",
|
|
55
56
|
"test": "vitest run"
|
|
56
57
|
}
|