made the module simpler to use...

Signed-off-by: Alex A. Naanou <alex.nanou@gmail.com>
This commit is contained in:
Alex A. Naanou 2022-07-05 23:14:09 +03:00
parent 777bc53dd0
commit 7223251ca6
2 changed files with 14 additions and 16 deletions

View File

@ -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": {

View File

@ -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 })