MCPcopy Create free account
hub / github.com/hoothin/UserScripts / unwrap

Function unwrap

Picviewer CE+/dist.user.js:4634–4648  ·  view source on GitHub ↗
(promise, func, value)

Source from the content-addressed store, hash-verified

4632};
4633
4634function unwrap(promise, func, value) {
4635 immediate(function () {
4636 var returnValue;
4637 try {
4638 returnValue = func(value);
4639 } catch (e) {
4640 return handlers.reject(promise, e);
4641 }
4642 if (returnValue === promise) {
4643 handlers.reject(promise, new TypeError('Cannot resolve promise with itself'));
4644 } else {
4645 handlers.resolve(promise, returnValue);
4646 }
4647 });
4648}
4649
4650handlers.resolve = function (self, value) {
4651 var result = tryCatch(getThen, value);

Callers 1

dist.user.jsFile · 0.70

Calls 1

immediateFunction · 0.70

Tested by

no test coverage detected