mirror of
https://github.com/flynx/stoppable.js.git
synced 2025-10-29 10:50:08 +00:00
made the module simpler to use...
Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
parent
777bc53dd0
commit
7223251ca6
@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "ig-stoppable",
|
"name": "ig-stoppable",
|
||||||
"version": "1.0.0",
|
"version": "2.0.0",
|
||||||
"description": "Utility library implementing tooling to make stoppable functions...",
|
"description": "Utility library implementing tooling to make stoppable functions...",
|
||||||
"main": "stoppable.js",
|
"main": "stoppable.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
28
stoppable.js
28
stoppable.js
@ -26,19 +26,6 @@ var AsyncGenerator =
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
|
||||||
|
|
||||||
var STOP =
|
|
||||||
module.STOP =
|
|
||||||
function(value){
|
|
||||||
return {
|
|
||||||
__proto__: STOP.prototype,
|
|
||||||
doc: 'stop iteration.',
|
|
||||||
value,
|
|
||||||
} }
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
//---------------------------------------------------------------------
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
// Wrap a callable in a STOP handler
|
// Wrap a callable in a STOP handler
|
||||||
@ -76,8 +63,7 @@ function(value){
|
|||||||
//
|
//
|
||||||
// NOTE: this repeats the same code at lest twice, not sure yet how to avoid
|
// NOTE: this repeats the same code at lest twice, not sure yet how to avoid
|
||||||
// this...
|
// this...
|
||||||
var stoppable =
|
module =
|
||||||
module.stoppable =
|
|
||||||
function(func){
|
function(func){
|
||||||
return Object.assign(
|
return Object.assign(
|
||||||
func instanceof Generator ?
|
func instanceof Generator ?
|
||||||
@ -140,5 +126,17 @@ function(func){
|
|||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
//---------------------------------------------------------------------
|
||||||
|
|
||||||
|
module.STOP =
|
||||||
|
function(value){
|
||||||
|
return {
|
||||||
|
__proto__: module.STOP.prototype,
|
||||||
|
doc: 'stop iteration.',
|
||||||
|
value,
|
||||||
|
} }
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/**********************************************************************
|
/**********************************************************************
|
||||||
* vim:set ts=4 sw=4 nowrap : */ return module })
|
* vim:set ts=4 sw=4 nowrap : */ return module })
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user