A set of general-purpose utility functions designed with functional programming principles in mind.
npm install @inglorious/utils

A set of general-purpose utility functions designed with functional programming principles in mind. This package is part of the Inglorious Forge monorepo.
---
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.
---
``bash`
npm install @inglorious/utils
---
Here are a few examples of how you can use the utilities in this package.
Compose functions together in a readable, left-to-right sequence.
`javascript
import { pipe } from "@inglorious/utils/functions/functions"
const add = (a) => (b) => a + b
const multiply = (a) => (b) => a * b
const calculate = pipe(
add(5), // 10 + 5 = 15
multiply(2), // 15 * 2 = 30
add(10), // 30 + 10 = 40
)
const result = calculate(10) // 40
`
Perform vector operations on plain objects.
`javascript
import { add } from "@inglorious/utils/math/vector.js"
const position = [10, 20]
const velocity = [2, -1]
const newPosition = add(position, velocity)
// => [12, 19]
`
---
This package is designed to be used with subpath imports, which helps with tree-shaking.
- @inglorious/utils/algorithms: Utilities for AI algorithms, like decision trees and A\*.
- @inglorious/utils/functions: Utilities for function composition.
- @inglorious/utils/math: Utilities for math operations.
- @inglorious/utils/physics: Utilities for calculations on friction, acceleration, and gravity.
---
MIT License - Free and open source
Created by Matteo Antony Mistretta
You're free to use, modify, and distribute this software. See LICENSE for details.
---
We welcome contributions! Please see the root CONTRIBUTING.md` file for more details.