From b6aae571a02cb570ca575ad08eb30c52b697ca68 Mon Sep 17 00:00:00 2001 From: Contra Date: Mon, 2 Jan 2017 13:47:02 -0500 Subject: [PATCH] Update: Fix linting error by using ternaries --- index.js | 21 ++++++--------------- 1 file changed, 6 insertions(+), 15 deletions(-) diff --git a/index.js b/index.js index 637cc5e..7a8aa96 100644 --- a/index.js +++ b/index.js @@ -20,21 +20,12 @@ function globStream(globs, opt) { var ourOpt = extend({}, opt); var ignore = ourOpt.ignore; - if (typeof ourOpt.cwd !== 'string') { - ourOpt.cwd = process.cwd(); - } - if (typeof ourOpt.dot !== 'boolean') { - ourOpt.dot = false; - } - if (typeof ourOpt.silent !== 'boolean') { - ourOpt.silent = true; - } - if (typeof ourOpt.nonull !== 'boolean') { - ourOpt.nonull = false; - } - if (typeof ourOpt.cwdbase !== 'boolean') { - ourOpt.cwdbase = false; - } + ourOpt.cwd = typeof ourOpt.cwd === 'string' ? ourOpt.cwd : process.cwd(); + ourOpt.dot = typeof ourOpt.dot === 'boolean' ? ourOpt.dot : false; + ourOpt.silent = typeof ourOpt.silent === 'boolean' ? ourOpt.silent : true; + ourOpt.nonull = typeof ourOpt.nonull === 'boolean' ? ourOpt.nonull : false; + ourOpt.cwdbase = typeof ourOpt.cwdbase === 'boolean' ? ourOpt.cwdbase : false; + if (ourOpt.cwdbase) { ourOpt.base = ourOpt.cwd; }