A simple curry function for JavaScript with no clever tricks and full test coverage.
Curry is a JavaScript module that provides a simple curry function for creating curried functions, enabling partial application and functional programming techniques. It solves the problem of manually managing function arguments by automatically generating new functions when arguments are missing, making code more composable and reusable.
JavaScript developers working in functional programming or those looking to adopt currying and partial application patterns in their codebases.
Developers choose Curry for its simplicity, predictability, and lack of clever tricks, ensuring reliable behavior with full test coverage. It offers essential utilities like explicit arity control and context adaptation without unnecessary complexity.
simple curry module, with nothing too clever, and full test coverage
Open-Awesome is built by the community, for the community. Submit a project, suggest an awesome list, or help improve the catalog on GitHub.
The curry function automatically creates curried functions that return new functions for missing arguments, as shown in the add example, making partial application intuitive and reliable.
curry.to allows specifying function arity explicitly, which is essential for wrapping variadic functions like sum, providing precise control over argument count without relying on parameter detection.
curry.adapt and curry.adaptTo shift context parameters to the last argument, adapting functions from libraries like delve or lodash to a curried interface, as demonstrated in the examples.
Curried functions expose .length to indicate remaining expected arguments, aiding in debugging and functional composition, as seen with zipWith.length in the README.
It focuses solely on currying without supporting advanced functional patterns like composition, transducers, or immutable data structures, which are available in libraries like Ramda.
For browser use without module bundlers, setup requires manual script loading as shown in the README, which is cumbersome and less modern compared to ES module imports or automated builds.
The library doesn't include TypeScript definitions or mention TypeScript integration, forcing users to create or find external type definitions, adding overhead for type-safe projects.