ubergoob
6/24/2016 - 7:07 AM

Quick and dirty nodejs helper module.

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;