Skip to content
This repository has been archived by the owner. It is now read-only.
master
Switch branches/tags
Go to file
Code

Latest commit

 

Git stats

Files

Permalink
Failed to load latest commit information.
Type
Name
Latest commit message
Commit time
 
 
src
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

eventual-values

eventual-values is a tiny JS library that lets you to create values that are themselved pending, errored, or resolved. It is inspired by the eventual library.

Installation

eventual-values is available on npm:

npm install eventual-values

Usage

var eventual = require('eventual-values');

// Create an eventual value
var val = eventual();

// Check its status
eventual.isReady(val);   // => false
eventual.isError(val);   // => false
eventual.isPending(val); // => true

// reject the value
val = eventual.reject('Access denied');
eventual.isReady(val);   // => false
eventual.isError(val);   // => true
eventual.isPending(val); // => false

// Any error is an errored value
eventual.isError(new Error('Access denied')); // => true

// Any other value is a resolved value
eventual.isReady('OK');   // => true
eventual.isError('OK');   // => false
eventual.isPending('OK'); // => false

With ES2015

import eventual, {isReady} from 'eventual-values';

About

No description, website, or topics provided.

Resources

License

Packages

No packages published