Package Exports
- @zoeykr/function-al
Readme
function-al
: A type-safe utility library for functional programming.
📌 Installation
npm i @zoeykr/function-al@latest📌 API Reference
Core Utilities
| Function | Description |
|---|---|
| partial | Creates a function with preset initial arguments, returning a new function for remaining inputs. |
| curry | Transforms a function into a curried version, allowing it to be called with arguments one at a time or in groups, until all arguments are provided. |
| pipe | Combines multiple functions into a single function, applying them sequentially from left to right. |
| compose | Combines multiple functions into a single function, applying them sequentially from right to left. |
| spreadArgs | Converts an array of arguments into separate function parameters. |
| gatherArgs | Transforms multiple arguments into an array |
| identity | Simply returns its input as-is |
| unary | Transforms a function so that it accepts only a single argument |
| noop | No operation function |
Type Guards
| Function | Description |
|---|---|
| isNumber | Checks if the input is of type number (NaN returns true). |
| isValidNumber | Ensures the input is a valid number (excludes NaN). |
| isInteger | Determines whether the input is an integer. |
| isSafeInteger | Checks if the input is a safe integer. |
| isFiniteNumber | Verifies that the input is a finite number. |
| isPositive | Determines if the input is a positive number (greater than zero). |
| isNegative | Determines if the input is a negative number (less than zero). |
| isZero | Checks whether the input is exactly zero. |
🤝 Contributing
Contributions are welcome! 👋
If you have ideas for new utilities, find a bug, or want to improve documentation, feel free to check out the Contributing Guide.
📜 License
This project is licensed under the MIT License.