mirror of
https://github.com/idanoo/GoScrobble.git
synced 2024-11-25 09:55:15 +00:00
16 lines
532 B
JavaScript
16 lines
532 B
JavaScript
"use strict";
|
|
|
|
var ensurePlainFunction = require("../../object/ensure-plain-function")
|
|
, ensureThenable = require("../../object/ensure-thenable")
|
|
, microtaskDelay = require("../../function/#/microtask-delay");
|
|
|
|
module.exports = function (callback) {
|
|
ensureThenable(this);
|
|
ensurePlainFunction(callback);
|
|
// Rely on microtaskDelay to escape eventual error swallowing
|
|
this.then(
|
|
microtaskDelay.call(function (value) { callback(null, value); }),
|
|
microtaskDelay.call(function (reason) { callback(reason); })
|
|
);
|
|
};
|