declarative-js
v3.10.0
Published
_declarative-js_ is modern JavaScript library, that helps to: - tackle array transformation with built in JavaScript array api (e.g. `array.filter(toBe.unique())`), - provide a type-level solution for representing optional values instead of null referen
Maintainers
Readme
What is declarative-js
declarative-js is modern JavaScript library, that helps to:
- tackle array transformation with built in JavaScript array api (e.g.
array.filter(toBe.unique())), - provide a type-level solution for representing optional values instead of null references.
Why declarative-js?
- performance (link to benchmarks)
- ability to use with built in api (js array)
- it is written in
typescript. All functions provides great type inference - declarative code instead of imperative
- reduces boilerplate code providing performant and tested solutions
- comprehensive documentation (link)
Install
pnpm add declarative-jsExports
All existing exports are still available from their current namespaces (Reducer, Sort, toBe, Filter, Mapper, optional, Optional, JMap, Map).
You can also import everything from the unified d namespace:
import { d } from 'declarative-js'
const grouped = [{ type: 'a', value: 1 }]
.reduce(d.Reducer.groupBy('type'), d.Reducer.Map())
const mapped = [1, 2, 3].filter(d.toBe.present)
const map: d.MethodMap<number> = d.Map({ a: 1 })
const optional: d.OptionalInterface<number> = d.optional(42)Documentation
All documentation can be found here: link
License
MIT
