@wry/context
Advanced tools
Comparing version 0.3.1 to 0.3.2
@@ -122,7 +122,8 @@ var currentContext = null; | ||
var gen = genFn.apply(this, arguments); | ||
var next = bind(gen.next); | ||
var boundNext = bind(gen.next); | ||
var boundThrow = bind(gen["throw"]); | ||
return new Promise(function (resolve, reject) { | ||
function pump(valueToSend) { | ||
function invoke(method, argument) { | ||
try { | ||
var result = next.call(gen, valueToSend); | ||
var result = method.call(gen, argument); | ||
} | ||
@@ -132,11 +133,13 @@ catch (error) { | ||
} | ||
var step = result.done ? resolve : pump; | ||
var next = result.done ? resolve : invokeNext; | ||
if (isPromiseLike(result.value)) { | ||
result.value.then(step, reject); | ||
result.value.then(next, result.done ? reject : invokeThrow); | ||
} | ||
else { | ||
step(result.value); | ||
next(result.value); | ||
} | ||
} | ||
pump(); | ||
var invokeNext = function (value) { return invoke(boundNext, value); }; | ||
var invokeThrow = function (error) { return invoke(boundThrow, error); }; | ||
invokeNext(); | ||
}); | ||
@@ -143,0 +146,0 @@ }; |
@@ -126,7 +126,8 @@ 'use strict'; | ||
var gen = genFn.apply(this, arguments); | ||
var next = bind(gen.next); | ||
var boundNext = bind(gen.next); | ||
var boundThrow = bind(gen["throw"]); | ||
return new Promise(function (resolve, reject) { | ||
function pump(valueToSend) { | ||
function invoke(method, argument) { | ||
try { | ||
var result = next.call(gen, valueToSend); | ||
var result = method.call(gen, argument); | ||
} | ||
@@ -136,11 +137,13 @@ catch (error) { | ||
} | ||
var step = result.done ? resolve : pump; | ||
var next = result.done ? resolve : invokeNext; | ||
if (isPromiseLike(result.value)) { | ||
result.value.then(step, reject); | ||
result.value.then(next, result.done ? reject : invokeThrow); | ||
} | ||
else { | ||
step(result.value); | ||
next(result.value); | ||
} | ||
} | ||
pump(); | ||
var invokeNext = function (value) { return invoke(boundNext, value); }; | ||
var invokeThrow = function (error) { return invoke(boundThrow, error); }; | ||
invokeNext(); | ||
}); | ||
@@ -147,0 +150,0 @@ }; |
{ | ||
"name": "@wry/context", | ||
"version": "0.3.1", | ||
"version": "0.3.2", | ||
"author": "Ben Newman <ben@eloper.dev>", | ||
@@ -24,3 +24,3 @@ "description": "Manage contextual information needed by (a)synchronous tasks without explicitly passing objects around", | ||
"build": "npm run clean && npm run tsc && npm run rollup", | ||
"mocha": "node ../../node_modules/.bin/mocha --reporter spec --full-trace lib/tests.js", | ||
"mocha": "../../scripts/test.sh lib/tests.js", | ||
"prepublish": "npm run build", | ||
@@ -32,3 +32,3 @@ "test": "npm run build && npm run mocha" | ||
}, | ||
"gitHead": "3a0643ee8dda643e9ac20249442f3ea6ecc1bc8d" | ||
"gitHead": "c619f94dcebed8f4dbb0581997f890c42a2de192" | ||
} |
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
22171
414