summaryrefslogtreecommitdiff
path: root/deps/npm/node_modules/request/node_modules/form-data/node_modules/asynckit/lib/defer.js
diff options
context:
space:
mode:
Diffstat (limited to 'deps/npm/node_modules/request/node_modules/form-data/node_modules/asynckit/lib/defer.js')
-rw-r--r--deps/npm/node_modules/request/node_modules/form-data/node_modules/asynckit/lib/defer.js26
1 files changed, 26 insertions, 0 deletions
diff --git a/deps/npm/node_modules/request/node_modules/form-data/node_modules/asynckit/lib/defer.js b/deps/npm/node_modules/request/node_modules/form-data/node_modules/asynckit/lib/defer.js
new file mode 100644
index 0000000000..b67110c7ad
--- /dev/null
+++ b/deps/npm/node_modules/request/node_modules/form-data/node_modules/asynckit/lib/defer.js
@@ -0,0 +1,26 @@
+module.exports = defer;
+
+/**
+ * Runs provided function on next iteration of the event loop
+ *
+ * @param {function} fn - function to run
+ */
+function defer(fn)
+{
+ var nextTick = typeof setImmediate == 'function'
+ ? setImmediate
+ : (
+ typeof process == 'object' && typeof process.nextTick == 'function'
+ ? process.nextTick
+ : null
+ );
+
+ if (nextTick)
+ {
+ nextTick(fn);
+ }
+ else
+ {
+ setTimeout(fn, 0);
+ }
+}