Skip to content

Instantly share code, notes, and snippets.

@ubergoober
Created June 24, 2016 07:07
Show Gist options
  • Save ubergoober/df87a04f2ca81b88dab3917af760be9a to your computer and use it in GitHub Desktop.
Save ubergoober/df87a04f2ca81b88dab3917af760be9a to your computer and use it in GitHub Desktop.
Quick and dirty nodejs helper module.
'use strict';
var helpers = {};
/**
* Execute function asynchronously
* @param fn : function to execute async
* @param cb : callback to call if provided
*/
helpers.async = function(fn, cb) {
setTimeout(function(){
(typeof fn === 'function') ? fn() : false;
(typeof cb === 'function') ? cb() : false;
}, 0);
}
module.exports = helpers;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment