diff --git a/lib/replace-in-file.js b/lib/replace-in-file.js index 6fd19e1..cf9d0c5 100644 --- a/lib/replace-in-file.js +++ b/lib/replace-in-file.js @@ -20,7 +20,7 @@ function replaceInFile(config, cb) { config = parseConfig(config); } catch (error) { - if (cb) { + if (typeof cb === "function") { return cb(error, null); } return Promise.reject(error); @@ -45,7 +45,7 @@ function replaceInFile(config, cb) { //Success handler .then(results => { - if (cb) { + if (typeof cb === "function") { cb(null, results); } return results; @@ -53,7 +53,7 @@ function replaceInFile(config, cb) { //Error handler .catch(error => { - if (cb) { + if (typeof cb === "function") { cb(error); } else {