Created
June 24, 2016 07:07
-
-
Save ubergoober/df87a04f2ca81b88dab3917af760be9a to your computer and use it in GitHub Desktop.
Quick and dirty nodejs helper module.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
'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