mirror of
https://github.com/flynx/stoppable.js.git
synced 2025-10-28 10:20:10 +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",
|
||||
"version": "1.0.0",
|
||||
"version": "2.0.0",
|
||||
"description": "Utility library implementing tooling to make stoppable functions...",
|
||||
"main": "stoppable.js",
|
||||
"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
|
||||
@ -76,8 +63,7 @@ function(value){
|
||||
//
|
||||
// NOTE: this repeats the same code at lest twice, not sure yet how to avoid
|
||||
// this...
|
||||
var stoppable =
|
||||
module.stoppable =
|
||||
module =
|
||||
function(func){
|
||||
return Object.assign(
|
||||
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 })
|
||||
|
||||
Loading…
x
Reference in New Issue
Block a user