Skip to content

Commit

Permalink
Update: Remove unnecessary utility modules
Browse files Browse the repository at this point in the history
  • Loading branch information
phated committed Dec 21, 2017
1 parent dcc8490 commit 1de3603
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 45 deletions.
7 changes: 0 additions & 7 deletions lib/shared/is-array.js

This file was deleted.

7 changes: 0 additions & 7 deletions lib/shared/is-number.js

This file was deleted.

7 changes: 0 additions & 7 deletions lib/shared/is-string.js

This file was deleted.

9 changes: 3 additions & 6 deletions lib/shared/log/copy-tree.js
Original file line number Diff line number Diff line change
@@ -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) {
Expand All @@ -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);
}

Expand Down Expand Up @@ -69,7 +66,7 @@ function copyTree(tree, opts, nodeFactory) {
}

function forEach(nodes, fn) {
if (!isArray(nodes)) {
if (!Array.isArray(nodes)) {
return;
}

Expand Down
5 changes: 2 additions & 3 deletions lib/shared/log/tasks.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');

Expand Down Expand Up @@ -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);
Expand All @@ -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);
Expand Down
3 changes: 1 addition & 2 deletions lib/versioned/^3.7.0/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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));
Expand Down
5 changes: 2 additions & 3 deletions lib/versioned/^4.0.0-alpha.1/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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));
Expand All @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions lib/versioned/^4.0.0-alpha.2/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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));
Expand All @@ -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);
Expand Down
5 changes: 2 additions & 3 deletions lib/versioned/^4.0.0/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -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');
Expand Down Expand Up @@ -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));
Expand All @@ -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);
Expand Down
6 changes: 2 additions & 4 deletions lib/versioned/^4.0.0/log/getTask.js
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand All @@ -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;
}
}
Expand Down

0 comments on commit 1de3603

Please sign in to comment.