wishthis/node_modules/gulp-cli/lib/versioned/^4.0.0/log/get-task.js
2022-01-21 09:28:41 +01:00

43 lines
879 B
JavaScript

'use strict';
var isObject = require('isobject');
function getTask(gulpInst) {
return function(name) {
var task = gulpInst.task(name);
return {
description: getDescription(task),
flags: getFlags(task),
};
};
}
function getDescription(task) {
if (typeof task.description === 'string') {
return task.description;
}
/* istanbul ignore else */
if (typeof task.unwrap === 'function') {
var origFn = task.unwrap();
if (typeof origFn.description === 'string') {
return origFn.description;
}
}
return undefined;
}
function getFlags(task) {
if (isObject(task.flags)) {
return task.flags;
}
/* istanbul ignore else */
if (typeof task.unwrap === 'function') {
var origFn = task.unwrap();
if (isObject(origFn.flags)) {
return origFn.flags;
}
}
return undefined;
}
module.exports = getTask;