UNPKG

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
# 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/) [![npm version](https://badge.fury.io/js/declarative-js.svg)](https://www.npmjs.com/package/declarative-js) [![Build Status](https://travis-ci.org/pavel-surinin/declarativejs.svg?branch=master)](https://travis-ci.org/pavel-surinin/declarative-js) [![Coverage Status](https://coveralls.io/repos/github/pavel-surinin/declarativejs/badge.svg?branch=master)](https://coveralls.io/github/pavel-surinin/declarativejs?branch=master) [![Language grade: JavaScript](https://img.shields.io/lgtm/grade/javascript/g/pavel-surinin/declarativejs.svg?logo=lgtm&logoWidth=18)](https://lgtm.com/projects/g/pavel-surinin/declarativejs/context:javascript) ![](https://shields-staging.herokuapp.com/npm/dm/declarative-js.svg) ![](https://shields-staging.herokuapp.com/npm/types/declarative-js.svg) # 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