Skip to content

chorobin/unify

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

9 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Unify

Unify provides a generic monad/functor higher order functions which work on multiple libraries. ImmutableJS, Maybe type, RxJS and Arrays. They all work using the same higher order function.

It uses conditional types in TypeScript 2.8 to not lose type information

Getting Started

npm install unify --save

Prerequisites

Map works on an array

const array: Array<number> = [1, 2, 3];
const fn = (x: number) => x * 2;
const timesTwo: Array<number> = map(fn)(array);

Works on the Maybe type

const maybeNumber: Maybe<number> = maybe(1);
const fn = (x: number) => x * 2;
const timesTwo: Maybe<number> = map(fn)(maybeNumber);

Works on Observables!

const stream$: Observable<number> = of(1, 2, 3);
const fn = (x: number) => x * 2;
const timesTwo$: Observable<number> = map(fn)(stream$);

Works on ImmutableJS!

const list: List<number> = List.of(1, 2, 3);
const fn = (x: number) => x * 2;
const timesTwo: List<number> = map(fn)(list);

Installing

npm install unify --save

Running the tests

npm run test

Authors

See also the list of contributors who participated in this project.

License

This project is licensed under the MIT License - see the LICENSE.md file for details

Acknowledgments

  • RxJS
  • ImmutableJS
  • Monads!

About

No description, website, or topics provided.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published