Skip to content

Commit 1de3603

Browse files
committed
Update: Remove unnecessary utility modules
1 parent dcc8490 commit 1de3603

File tree

10 files changed

+14
-45
lines changed

10 files changed

+14
-45
lines changed

lib/shared/is-array.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

lib/shared/is-number.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

lib/shared/is-string.js

Lines changed: 0 additions & 7 deletions
This file was deleted.

lib/shared/log/copy-tree.js

Lines changed: 3 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,5 @@
11
'use strict';
22

3-
var isArray = require('../is-array');
4-
var isNumber = require('../is-number');
5-
63
function copyNode(node) {
74
var newNode = {};
85
Object.keys(node).forEach(function(key) {
@@ -21,14 +18,14 @@ function copyTree(tree, opts, nodeFactory) {
2118
opts = opts || {};
2219

2320
var depth = opts.tasksDepth;
24-
depth = !isNumber(depth) ? null : ((depth < 1) ? 1 : depth);
21+
depth = typeof depth === 'number' ? ((depth < 1) ? 1 : depth) : null;
2522

2623
nodeFactory = nodeFactory || defaultNodeFactory;
2724

2825
var newTree = nodeFactory.topNode(tree);
2926
newTree.nodes = [];
3027

31-
if (isArray(tree.nodes)) {
28+
if (Array.isArray(tree.nodes)) {
3229
tree.nodes.forEach(visit);
3330
}
3431

@@ -69,7 +66,7 @@ function copyTree(tree, opts, nodeFactory) {
6966
}
7067

7168
function forEach(nodes, fn) {
72-
if (!isArray(nodes)) {
69+
if (!Array.isArray(nodes)) {
7370
return;
7471
}
7572

lib/shared/log/tasks.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@ var log = require('gulplog');
66

77
var sortBy = require('array-sort');
88
var isObject = require('isobject');
9-
var isString = require('../is-string');
109

1110
var copyTree = require('./copy-tree');
1211

@@ -65,7 +64,7 @@ function getNodeFactory(getTask, entryObserver) {
6564

6665
var newNode = {
6766
label: node.label,
68-
desc: isString(task.description) ? task.description : '',
67+
desc: typeof task.description === 'string' ? task.description : '',
6968
opts: [],
7069
};
7170
entryObserver.topTask(newNode);
@@ -77,7 +76,7 @@ function getNodeFactory(getTask, entryObserver) {
7776
}
7877
var opt = {
7978
label: flag,
80-
desc: isString(task.flags[flag]) ? task.flags[flag] : '',
79+
desc: typeof task.flags[flag] === 'string' ? task.flags[flag] : '',
8180
};
8281
entryObserver.option(opt);
8382
newNode.opts.push(opt);

lib/versioned/^3.7.0/index.js

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ var tildify = require('tildify');
88
var taskTree = require('./taskTree');
99

1010
var logTasks = require('../../shared/log/tasks');
11-
var isString = require('../../shared/is-string');
1211
var logEvents = require('./log/events');
1312
var logTasksSimple = require('./log/tasksSimple');
1413
var registerExports = require('../../shared/registerExports');
@@ -42,7 +41,7 @@ function execute(opts, env, config) {
4241
}
4342
if (opts.tasks) {
4443
tree = taskTree(gulpInst.tasks);
45-
if (config.description && isString(config.description)) {
44+
if (config.description && typeof config.description === 'string') {
4645
tree.label = config.description;
4746
} else {
4847
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath));

lib/versioned/^4.0.0-alpha.1/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ var stdout = require('mute-stdout');
88
var tildify = require('tildify');
99

1010
var exit = require('../../shared/exit');
11-
var isString = require('../../shared/is-string');
1211

1312
var logTasks = require('../../shared/log/tasks');
1413
var logEvents = require('../^4.0.0/log/events');
@@ -48,7 +47,7 @@ function execute(opts, env, config) {
4847
}
4948
if (opts.tasks) {
5049
tree = {};
51-
if (config.description && isString(config.description)) {
50+
if (config.description && typeof config.description === 'string') {
5251
tree.label = config.description;
5352
} else {
5453
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath));
@@ -60,7 +59,7 @@ function execute(opts, env, config) {
6059
}
6160
if (opts.tasksJson) {
6261
tree = {};
63-
if (config.description && isString(config.description)) {
62+
if (config.description && typeof config.description === 'string') {
6463
tree.label = config.description;
6564
} else {
6665
tree.label = 'Tasks for ' + tildify(env.configPath);

lib/versioned/^4.0.0-alpha.2/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ var stdout = require('mute-stdout');
88
var tildify = require('tildify');
99

1010
var exit = require('../../shared/exit');
11-
var isString = require('../../shared/is-string');
1211

1312
var logTasks = require('../../shared/log/tasks');
1413
var logEvents = require('../^4.0.0/log/events');
@@ -50,7 +49,7 @@ function execute(opts, env, config) {
5049
}
5150
if (opts.tasks) {
5251
tree = gulpInst.tree({ deep: true });
53-
if (config.description && isString(config.description)) {
52+
if (config.description && typeof config.description === 'string') {
5453
tree.label = config.description;
5554
} else {
5655
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath));
@@ -60,7 +59,7 @@ function execute(opts, env, config) {
6059
}
6160
if (opts.tasksJson) {
6261
tree = gulpInst.tree({ deep: true });
63-
if (config.description && isString(config.description)) {
62+
if (config.description && typeof config.description === 'string') {
6463
tree.label = config.description;
6564
} else {
6665
tree.label = 'Tasks for ' + tildify(env.configPath);

lib/versioned/^4.0.0/index.js

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ var stdout = require('mute-stdout');
88
var tildify = require('tildify');
99

1010
var exit = require('../../shared/exit');
11-
var isString = require('../../shared/is-string');
1211

1312
var logTasks = require('../../shared/log/tasks');
1413
var logEvents = require('./log/events');
@@ -50,7 +49,7 @@ function execute(opts, env, config) {
5049
}
5150
if (opts.tasks) {
5251
tree = gulpInst.tree({ deep: true });
53-
if (config.description && isString(config.description)) {
52+
if (config.description && typeof config.description === 'string') {
5453
tree.label = config.description;
5554
} else {
5655
tree.label = 'Tasks for ' + chalk.magenta(tildify(env.configPath));
@@ -60,7 +59,7 @@ function execute(opts, env, config) {
6059
}
6160
if (opts.tasksJson) {
6261
tree = gulpInst.tree({ deep: true });
63-
if (config.description && isString(config.description)) {
62+
if (config.description && typeof config.description === 'string') {
6463
tree.label = config.description;
6564
} else {
6665
tree.label = 'Tasks for ' + tildify(env.configPath);

lib/versioned/^4.0.0/log/getTask.js

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -2,8 +2,6 @@
22

33
var isObject = require('isobject');
44

5-
var isString = require('../../../shared/is-string');
6-
75
function getTask(gulpInst) {
86
return function(name) {
97
var task = gulpInst.task(name);
@@ -15,12 +13,12 @@ function getTask(gulpInst) {
1513
}
1614

1715
function getDescription(task) {
18-
if (isString(task.description)) {
16+
if (typeof task.description === 'string') {
1917
return task.description;
2018
}
2119
if (typeof task.unwrap === 'function') {
2220
var origFn = task.unwrap();
23-
if (isString(origFn.description)) {
21+
if (typeof origFn.description === 'string') {
2422
return origFn.description;
2523
}
2624
}

0 commit comments

Comments
 (0)