1.2.10 • Published 2 years ago

fputils v1.2.10

Weekly downloads
71
License
ISC
Repository
github
Last release
2 years ago

FP utils

A bunch of useful utility functions

Examples

Either

import { either, Either, Right, Left } from 'fputils';

// define fetch function, this function does not throw, but returns Either data or error instead
const get = <T>(url: string): Either<Error, T> => new Promise(async resolve => {
    try {
        return resolve(Right(await fetch(url)))
    } catch (error) {
        return resolve(Left(error))
    }
});

// either usage
either((error) => {
    console.error({ error })
}, (result) => {
    console.log({ result })
}, await get<string[]>('https://api'));
1.2.9

2 years ago

1.2.10

2 years ago

1.2.8

3 years ago

1.2.7

3 years ago

1.2.6

3 years ago

1.2.5

3 years ago

1.2.4

3 years ago

1.2.3

3 years ago

1.2.0

3 years ago

1.2.2

3 years ago

1.2.1

3 years ago

1.1.6

3 years ago

1.1.5

3 years ago

1.1.4

3 years ago

1.1.3

3 years ago

1.1.2

3 years ago

1.0.12

4 years ago

1.0.10

4 years ago

1.0.11

5 years ago

1.0.9

6 years ago

1.0.8

6 years ago

1.0.7

7 years ago

1.0.6

7 years ago

1.0.5

7 years ago

1.0.3

7 years ago

1.0.2

7 years ago

1.0.1

7 years ago

1.0.0

7 years ago