0.5.0 • Published 7 years ago
@promises/next v0.5.0
@promises/next
Next is package from Promises library
Use
Module
$ npm install --save @promises/nextimport {
default as next
} from '@promises/next';Browser
<script src="https://unpkg.com/@promises/next/bundle.umd.min.js"></script>let {
next
} = P;Examples
let promise: Promise<string> = Promise.resolve<string>('foo');
next(promise, 'bar').then((result: string) => {
console.log(result); // => 'bar'
}); let promise: Promise<string> = Promise.reject<string>('foo');
next(promise, 'bar').then((result: string) => {
console.log(result); // => 'bar'
});Functional programming
Module
$ npm install --save @promises/nextimport {
__,
default as next
} from '@promises/next/fp';Browser
<script src="https://unpkg.com/@promises/next/fp/bundle.umd.min.js"></script>let {
__,
next
} = PF;Examples
let promise: Promise<string> = Promise.resolve<string>('foo');
next('bar', promise).then((result: string) => {
console.log(result); // => 'bar'
}); let promise: Promise<string> = Promise.reject<string>('foo');
next('bar', promise).then((result: string) => {
console.log(result); // => 'bar'
});Wrapper
Module
$ npm install --save @promises/nextimport Promises from '@promises/core';
import '@promises/next/add';Or
import Promises from '@promises/next/add';Browser
<script src="https://unpkg.com/@promises/core/bundle.umd.min.js"></script>
<script src="https://unpkg.com/@promises/next/add/bundle.umd.min.js"></script>let {
Promises
} = P;Examples
let promises: Promises<string> = Promises.resolve<string>('foo').next('bar');
promises.then((result: string) => {
console.log(result); // => 'bar'
});,
let promises: Promises<string> = Promises.reject<string>('foo').next('bar');
promises.then((result: string) => {
console.log(result); // => 'bar'
});Compatibility
These modules are written in typescript and available in ES5 and ES6 standard, the requirements are a global Promise (native or polyfill).
License
Copyright © 2017 Yisrael Eliav, Licensed under the MIT license.