Iiris is an experimental utility library, designed to make it easier to manipulate built-in JavaScript data types like arrays, objects and strings in a functional manner. It is heavily inspired by projects like Ramda and Lodash.
- No mutation of input data.
- Automatically curried, data-last API.
- Performance on par with native JavaScript methods.
- Good out-of-the-box TypeScript typings.
- Small footprint (4 kB gzipped) and excellent tree-shaking support.
- Support only native JavaScript data types.
- Target reasonably current JavaScript environments (Node 10+)
Iiris is still alpha-quality software, so bugs and changes to the API should be expected.
If you've tried Iiris and something doesn't seem to be working as expected, let me know!
Run either
$ npm install iiris
or
$ yarn add iiris
depending on your favourite package manager.
Iiris is heavily inspired by libraries like Ramda and Lodash. However, there are a few things that make it different:
Compared to lodash:
- Each function is automatically curried and input data is always the last argument.
- Input data is never mutated.
- Chaining is achieved with function composition instead of special constructs like
_.chain
. - Iiris doesn't support any kind of iteratee shorthands.
Compared to Ramda:
- Much better TypeScript support. Typically, you don't have to add any extra type annotations when using Iiris, even when writing code in point-free style.
- Iiris functions are less polymorphic. For example,
I.map
operates only on arrays, whileR.map
supports arrays, objects and arbitrary fantasy-land functors. TypeScript doesn't have native support for higher-kinded types (although some people have tried to work around that), so I made an intentional decision to limit the polymorphism of Iiris functions. This makes code less general but dramatically improves the TypeScript experience and makes tree-shaking more effective. - No support for placeholders. Placeholders add some overhead to each curried function call and make writing TypeScript typings much harder.
- A bigger focus on performance.
Compared to both:
- Iiris requires a fairly modern JavaScript engine (Node 10+) to run.