diff --git a/lib/shared/is-array.js b/lib/shared/is-array.js deleted file mode 100644 index 70373f16..00000000 --- a/lib/shared/is-array.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -function isArray(val) { - return Array.isArray(val); -} - -module.exports = isArray; diff --git a/lib/shared/is-number.js b/lib/shared/is-number.js deleted file mode 100644 index 061505c2..00000000 --- a/lib/shared/is-number.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -function isNumber(val) { - return (typeof val === 'number'); -} - -module.exports = isNumber; diff --git a/lib/shared/is-string.js b/lib/shared/is-string.js deleted file mode 100644 index f0026b3b..00000000 --- a/lib/shared/is-string.js +++ /dev/null @@ -1,7 +0,0 @@ -'use strict'; - -function isString(val) { - return (typeof val === 'string'); -} - -module.exports = isString; diff --git a/lib/shared/log/copy-tree.js b/lib/shared/log/copy-tree.js index e32ff90d..99d7b5fa 100644 --- a/lib/shared/log/copy-tree.js +++ b/lib/shared/log/copy-tree.js @@ -1,8 +1,5 @@ 'use strict'; -var isArray = require('../is-array'); -var isNumber = require('../is-number'); - function copyNode(node) { var newNode = {}; Object.keys(node).forEach(function(key) { @@ -21,14 +18,14 @@ function copyTree(tree, opts, nodeFactory) { opts = opts || {}; var depth = opts.tasksDepth; - depth = !isNumber(depth) ? null : ((depth < 1) ? 1 : depth); + depth = typeof depth === 'number' ? ((depth < 1) ? 1 : depth) : null; nodeFactory = nodeFactory || defaultNodeFactory; var newTree = nodeFactory.topNode(tree); newTree.nodes = []; - if (isArray(tree.nodes)) { + if (Array.isArray(tree.nodes)) { tree.nodes.forEach(visit); } @@ -69,7 +66,7 @@ function copyTree(tree, opts, nodeFactory) { } function forEach(nodes, fn) { - if (!isArray(nodes)) { + if (!Array.isArray(nodes)) { return; } diff --git a/lib/shared/log/tasks.js b/lib/shared/log/tasks.js index e0a72dd6..697066db 100644 --- a/lib/shared/log/tasks.js +++ b/lib/shared/log/tasks.js @@ -6,7 +6,6 @@ var log = require('gulplog'); var sortBy = require('array-sort'); var isObject = require('isobject'); -var isString = require('../is-string'); var copyTree = require('./copy-tree'); @@ -65,7 +64,7 @@ function getNodeFactory(getTask, entryObserver) { var newNode = { label: node.label, - desc: isString(task.description) ? task.description : '', + desc: typeof task.description === 'string' ? task.description : '', opts: [], }; entryObserver.topTask(newNode); @@ -77,7 +76,7 @@ function getNodeFactory(getTask, entryObserver) { } var opt = { label: flag, - desc: isString(task.flags[flag]) ? task.flags[flag] : '', + desc: typeof task.flags[flag] === 'string' ? task.flags[flag] : '', }; entryObserver.option(opt); newNode.opts.push(opt); diff --git a/lib/versioned/^3.7.0/index.js b/lib/versioned/^3.7.0/index.js index 6e3eda7e..6dc4a96f 100644 --- a/lib/versioned/^3.7.0/index.js +++ b/lib/versioned/^3.7.0/index.js @@ -8,7 +8,6 @@ var tildify = require('tildify'); var taskTree = require('./taskTree'); var logTasks = require('../../shared/log/tasks'); -var isString = require('../../shared/is-string'); var logEvents = require('./log/events'); var logTasksSimple = require('./log/tasksSimple'); var registerExports = require('../../shared/registerExports'); @@ -42,7 +41,7 @@ function execute(opts, env, config) { } if (opts.tasks) { tree = taskTree(gulpInst.tasks); - if (config.description && isString(config.description)) { + if (config.description && typeof config.description === 'string') { tree.label = config.description; } else { tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath)); diff --git a/lib/versioned/^4.0.0-alpha.1/index.js b/lib/versioned/^4.0.0-alpha.1/index.js index 3b3aa0f1..e5f55b1d 100644 --- a/lib/versioned/^4.0.0-alpha.1/index.js +++ b/lib/versioned/^4.0.0-alpha.1/index.js @@ -8,7 +8,6 @@ var stdout = require('mute-stdout'); var tildify = require('tildify'); var exit = require('../../shared/exit'); -var isString = require('../../shared/is-string'); var logTasks = require('../../shared/log/tasks'); var logEvents = require('../^4.0.0/log/events'); @@ -48,7 +47,7 @@ function execute(opts, env, config) { } if (opts.tasks) { tree = {}; - if (config.description && isString(config.description)) { + if (config.description && typeof config.description === 'string') { tree.label = config.description; } else { tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath)); @@ -60,7 +59,7 @@ function execute(opts, env, config) { } if (opts.tasksJson) { tree = {}; - if (config.description && isString(config.description)) { + if (config.description && typeof config.description === 'string') { tree.label = config.description; } else { tree.label = 'Tasks for ' + tildify(env.configPath); diff --git a/lib/versioned/^4.0.0-alpha.2/index.js b/lib/versioned/^4.0.0-alpha.2/index.js index aba74979..2101557f 100644 --- a/lib/versioned/^4.0.0-alpha.2/index.js +++ b/lib/versioned/^4.0.0-alpha.2/index.js @@ -8,7 +8,6 @@ var stdout = require('mute-stdout'); var tildify = require('tildify'); var exit = require('../../shared/exit'); -var isString = require('../../shared/is-string'); var logTasks = require('../../shared/log/tasks'); var logEvents = require('../^4.0.0/log/events'); @@ -50,7 +49,7 @@ function execute(opts, env, config) { } if (opts.tasks) { tree = gulpInst.tree({ deep: true }); - if (config.description && isString(config.description)) { + if (config.description && typeof config.description === 'string') { tree.label = config.description; } else { tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath)); @@ -60,7 +59,7 @@ function execute(opts, env, config) { } if (opts.tasksJson) { tree = gulpInst.tree({ deep: true }); - if (config.description && isString(config.description)) { + if (config.description && typeof config.description === 'string') { tree.label = config.description; } else { tree.label = 'Tasks for ' + tildify(env.configPath); diff --git a/lib/versioned/^4.0.0/index.js b/lib/versioned/^4.0.0/index.js index 73c19c8b..d0cc7802 100644 --- a/lib/versioned/^4.0.0/index.js +++ b/lib/versioned/^4.0.0/index.js @@ -8,7 +8,6 @@ var stdout = require('mute-stdout'); var tildify = require('tildify'); var exit = require('../../shared/exit'); -var isString = require('../../shared/is-string'); var logTasks = require('../../shared/log/tasks'); var logEvents = require('./log/events'); @@ -50,7 +49,7 @@ function execute(opts, env, config) { } if (opts.tasks) { tree = gulpInst.tree({ deep: true }); - if (config.description && isString(config.description)) { + if (config.description && typeof config.description === 'string') { tree.label = config.description; } else { tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath)); @@ -60,7 +59,7 @@ function execute(opts, env, config) { } if (opts.tasksJson) { tree = gulpInst.tree({ deep: true }); - if (config.description && isString(config.description)) { + if (config.description && typeof config.description === 'string') { tree.label = config.description; } else { tree.label = 'Tasks for ' + tildify(env.configPath); diff --git a/lib/versioned/^4.0.0/log/getTask.js b/lib/versioned/^4.0.0/log/getTask.js index 55f43408..62891192 100644 --- a/lib/versioned/^4.0.0/log/getTask.js +++ b/lib/versioned/^4.0.0/log/getTask.js @@ -2,8 +2,6 @@ var isObject = require('isobject'); -var isString = require('../../../shared/is-string'); - function getTask(gulpInst) { return function(name) { var task = gulpInst.task(name); @@ -15,12 +13,12 @@ function getTask(gulpInst) { } function getDescription(task) { - if (isString(task.description)) { + if (typeof task.description === 'string') { return task.description; } if (typeof task.unwrap === 'function') { var origFn = task.unwrap(); - if (isString(origFn.description)) { + if (typeof origFn.description === 'string') { return origFn.description; } }