declarative-js
Version:
_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
47 lines (36 loc) • 2.25 kB
Markdown
# 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)](https://github.com/pavel-surinin/performance-bechmark/blob/master/output.md)
- 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)](https://pavel-surinin.github.io/declarativejs/)
[](https://www.npmjs.com/package/declarative-js)
[](https://travis-ci.org/pavel-surinin/declarative-js)
[](https://coveralls.io/github/pavel-surinin/declarativejs?branch=master)
[](https://lgtm.com/projects/g/pavel-surinin/declarativejs/context:javascript)


# Install
```
pnpm add declarative-js
```
# Exports
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:
```typescript
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](https://pavel-surinin.github.io/declarativejs/)
# License
MIT