0.5.0 • Published 6 years ago

@promises/compose v0.5.0

Weekly downloads
62
License
MIT
Repository
github
Last release
6 years ago

@promises/compose

Source Code Version MIT License Bundle Size

Compose is package from Promises library

Use

Module

$ npm install --save @promises/compose
import {
 default as compose
} from '@promises/compose';

Browser

<script src="https://unpkg.com/@promises/compose/bundle.umd.min.js"></script>
let {
 compose
} = P;

Examples

 let prefix = (str: string) => Promise.resolve(`_${str}`);
 let toUpperCase = (str: string) => String.prototype.toUpperCase.call(str);
 let method = compose(prefix, toUpperCase);

 method('some').then((result: string) => {
     console.log(result); // => '_SOME'
 });

Wrapper

Module

$ npm install --save @promises/compose
import Promises from '@promises/core';
import '@promises/compose/add';

Or

import Promises from '@promises/compose/add';

Browser

<script src="https://unpkg.com/@promises/core/bundle.umd.min.js"></script>
<script src="https://unpkg.com/@promises/compose/add/bundle.umd.min.js"></script>
let {
 Promises
} = P;

Examples

 let prefix = (str: string) => `_${str}`;
 let toUpperCase = (str: string) => String.prototype.toUpperCase.call(str);
 let method = Promises.compose(prefix, toUpperCase);

 method('some').then((result: string) => {
     console.log(result); // => '_SOME'
 });

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.