You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
87 lines
2.4 KiB
87 lines
2.4 KiB
# Specialized Promise Extensions
|
|
|
|
[](https://travis-ci.org/vitaly-t/spex)
|
|
[](https://coveralls.io/r/vitaly-t/spex?branch=master)
|
|
[](https://gitter.im/vitaly-t/spex?utm_source=badge&utm_medium=badge&utm_campaign=pr-badge&utm_content=badge)
|
|
|
|
[batch], [page], [sequence] - promise methods for the following patterns:
|
|
* [Data Throttling & Load Balancing](http://vitaly-t.github.io/spex/tutorial-throttling.html)
|
|
* [Linked and Detached Sequencing](http://vitaly-t.github.io/spex/tutorial-sequencing.html)
|
|
* [Streaming and Paging](http://vitaly-t.github.io/spex/tutorial-streaming.html)
|
|
* [Batch Processing](http://vitaly-t.github.io/spex/tutorial-batch.html)
|
|
|
|
## Installing
|
|
|
|
```
|
|
$ npm i spex
|
|
```
|
|
|
|
## Usage
|
|
|
|
* For any [Promises/A+] library: [Promise], [Bluebird], [When], [Q], [RSVP], etc.
|
|
|
|
```js
|
|
const promise = require('bluebird');
|
|
const spex = require('spex')(promise);
|
|
```
|
|
|
|
* For ES6 Promise:
|
|
|
|
```js
|
|
const spex = require('spex')(Promise);
|
|
```
|
|
|
|
See also: [client-side usage](http://vitaly-t.github.io/spex/tutorial-client.html).
|
|
|
|
## API
|
|
|
|
* [Module]
|
|
* Methods
|
|
- [batch]
|
|
- [page]
|
|
- [sequence]
|
|
- [stream](http://vitaly-t.github.io/spex/stream.html)
|
|
- [read]
|
|
|
|
## Testing
|
|
|
|
* Clone the repository (or download, if you prefer):
|
|
|
|
```
|
|
$ git clone https://github.com/vitaly-t/spex
|
|
```
|
|
|
|
* Install the library's DEV dependencies:
|
|
|
|
```
|
|
$ npm install
|
|
```
|
|
|
|
* To run all tests:
|
|
|
|
```
|
|
$ npm test
|
|
```
|
|
|
|
* To run all tests with coverage:
|
|
|
|
```
|
|
$ npm run coverage
|
|
```
|
|
|
|
## License
|
|
|
|
Copyright © 2020 [Vitaly Tomilov](https://github.com/vitaly-t);
|
|
Released under the MIT license.
|
|
|
|
[Module]:http://vitaly-t.github.io/spex/index.html
|
|
[batch]:http://vitaly-t.github.io/spex/global.html#batch
|
|
[page]:http://vitaly-t.github.io/spex/global.html#page
|
|
[sequence]:http://vitaly-t.github.io/spex/global.html#sequence
|
|
[read]:http://vitaly-t.github.io/spex/stream.html#.read
|
|
[Promises/A+]:https://promisesaplus.com/
|
|
[Promise]:https://github.com/then/promise
|
|
[Bluebird]:https://github.com/petkaantonov/bluebird
|
|
[When]:https://github.com/cujojs/when
|
|
[Q]:https://github.com/kriskowal/q
|
|
[RSVP]:https://github.com/tildeio/rsvp.js
|
|
|