MCPcopy
hub / github.com/jwagner/smartcrop.js / Q

Function Q

examples/q.js:449–463  ·  view source on GitHub ↗

* Constructs a promise for an immediate reference, passes promises through, or * coerces promises from different systems. * @param value immediate reference or promise

(value)

Source from the content-addressed store, hash-verified

447 * @param value immediate reference or promise
448 */
449function Q(value) {
450 // If the object is already a Promise, return it directly. This enables
451 // the resolve function to both be used to created references from objects,
452 // but to tolerably coerce non-promises to promises.
453 if (isPromise(value)) {
454 return value;
455 }
456
457 // assimilate thenables
458 if (isPromiseAlike(value)) {
459 return coerce(value);
460 } else {
461 return fulfill(value);
462 }
463}
464Q.resolve = Q;
465
466/**

Callers 11

deferFunction · 0.85
q.jsFile · 0.85
raceFunction · 0.85
whenFunction · 0.85
masterFunction · 0.85
spreadFunction · 0.85
continuerFunction · 0.85
dispatchFunction · 0.85
allSettledFunction · 0.85
progressFunction · 0.85
nodeifyFunction · 0.85

Calls 4

isPromiseFunction · 0.85
isPromiseAlikeFunction · 0.85
coerceFunction · 0.85
fulfillFunction · 0.85

Tested by

no test coverage detected