0.0.9 • Published 6 years ago

flex-value v0.0.9

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

flex-value

Build Status Coverage Status

Strongly-typed, value-resolution handler:

  • From a direct value
  • From value as a promise
  • From a callback that returns the value
  • From a callback that returns a promise

With support for generic error handling.


See Wiki for documentation and examples.

Install

npm i flex-value

Usage

import {Flex, FlexValue} from 'flex-value';

// fully-dynamic input/value:
const input: FlexValue<string>; // string | Promise<string> | (() => string | Promise<string>) 

// strongly-typed, actual value resolution:
const value: string = await Flex.get(input); 

And we can handle all types of errors in a generic way:

const onError = e => {
    // any error thrown or promise reject ends up here;
};

const value: string = await Flex.get(input, {onError});
0.0.9

6 years ago

0.0.8

6 years ago

0.0.7

6 years ago

0.0.6

6 years ago

0.0.5

6 years ago

0.0.4

6 years ago

0.0.3

6 years ago

0.0.2

6 years ago

0.0.1

6 years ago

0.0.1-Beta.1

6 years ago

0.0.1-Beta.0

6 years ago