rhax
v2.3.3
Published
Typescript library for simple and elegant data transformations
Downloads
947
Maintainers
Readme
Rhax
Rhax is a JavaScript utility library whose purpose is to make your day-to-day code perfect. It combines the best bits of functional programming with practicality, brevity and a solid type system to produce resilient, elegant code.
Getting started
To get started, head over to our docs.
Design principles
Declarative, Idiomatic & Consice
We believe JavaScript code is best written in a way that emphasizes your logic and intent.
Therefore, Rhax's utilities are designed to be declarative, idiomatic and concise. They're aimed to minimize the amount of gray code in your codebase, replacing it with easy-to-read, elegant operations that focus on your logic.
Functional Programming made practical
Rhax takes a non-traditional approach to functional programming: simplicity.
It's designed to utilize the best of FP - purity, immutability and declarative code - while keeping the paradigm's infamous problems out.
This means Rhax has no unnecessarily complex concepts, no ocean of jargon, and no surrendering your codebase to the paradigm.
For TypeScript users, by TypeScript users
One of Rhax's targets is to bring users the best typing Typescript can provide for common operations.
To this end, it uses generics and other advanced Typescript features commonly and thoroughly. It also provides wrappers for some very common native functions that have poor typing (such as Object.entries()
).
And even if you're not using Typescript, chances are your IDE does - and you can still benefits from Rhax's rich typing support through its intellisense.
Other features
- 🚀 Easy to pick up: Rhax was designed to be intuitive, and is simple to introduce into any codebase.
- 🪶 Lightweight: A small bundle size and tree-shaking make Rhax’s footprint extremely light.
- ⚙️ Modern: Rhax is written and built using modern JavaScript syntax and tools.
- 🤍 Open source: Now and forever.
Why FP?
Functional programming (FP) is a progamming paradigm founded on the ideas of immutability, function purity, and others. It has become increasingly popular over the past few years, and its benefits shine in a variety of applications. Most popular modern languages (JS/TS included) have FP capabilities, and you, like most developers of those languages, are probably already using FP to some degree, perhaps without realizing it.
However, the world of FP has many deep concepts - some rooted in abstract mathematics, some shrouded in FP terminology - and "true" functional programming requires a good understanding of most of those, as well as a commitment to the paradigm that's difficult to "break out" of when needed. This combination of a steep learning curve and a binding commitment is off-putting for many developers (myself included). Rhax was created with this slice of developers in mind - it aspires to provide a simple way for Javascript developers, new and seasoned, to enjoy the benefits of FP without having to climb or move mountains.
Another point is that FP - and its concepts of declarability and function purity in particular - deal extremely well with type systems. It can make a big difference in developer experience and in quality (elegance, brevity and maintainability). This is mostly true for Typescript developers, but can also assist plain Javascript developers through the intellisense features of modern IDEs.