diff --git a/loli.js b/loli.js index 6d669a1..e013428 100644 --- a/loli.js +++ b/loli.js @@ -105,9 +105,9 @@ exports.defaultConfig = cfg; exports.Config = Config; function randomise(cb, conf) { - if(conf) - var cfg = conf; - cfg.debug("Calling with params "+JSON.stringify(cfg)); - randomiseWith(cfg.debug, cfg.number, cfg.range, cfg.page, cfg.tags, cb); + if(!conf) + return randomise(cb, cfg); + conf.debug("Calling with params "+JSON.stringify(conf)); + randomiseWith(conf.debug, conf.number, conf.range, conf.page, conf.tags, cb); } exports.randomise = randomise;