started work on docs...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-07-06 00:23:18 +03:00
parent 7223251ca6
commit 21a343b5d2

View File

@ -1,2 +1,47 @@
# stoppable.js
Utility library implementing tooling to make stoppable functions...
```shell
$ npm install --save ig-stoppable
```
```javascript
var stoppable = require('ig-stoppable')
```
```javascript
var func = stoppable(function(){
// ...
throw stoppable.STOP('something')
// ...
})
var value = func() // -> 'something'
```
```javascript
var gen = stoppable(function*(){
// ...
throw stoppable.STOP('something')
// ...
})
var value = [...gen()] // -> ['somthing']
```
```javascript
var agen = stoppable(async function*(){
// ...
throw stoppable.STOP('something')
// ...
})
var value = awat agen() // -> ['something']
```