Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const isUrlOrPort = input => {
const str = is.string(input) ? input.split('|') : [input]
return str.every(s => {
if (is.url(s)) {
return s
}
// wait-on allows specifying HTTP verb to use instead of default HEAD
// and the format then is like "http-get://domain.com" to use GET
if (isWaitOnUrl(s)) {
return s
}
if (is.number(s)) {
return is.port(s)
}
if (!is.string(s)) {
return false
.spread((pathToFile, str) => {
if (hash) {
// if we have a hash then render
// the markdown contents so we can
// ensure it has the hash present!
la(is.string(str), 'expected a string to render, got', typeof str, str)
const html = render(str)
assertHashIsPresent(pathToFile, source, hash, html)
return pathToFile
}
return pathToFile
})
.then((pathToFile) => {
function normalizeModuleNames (moduleNames) {
if (!moduleNames) {
return
}
console.log('returning dependencies for')
console.dir(moduleNames)
if (check.string(moduleNames)) {
moduleNames = [moduleNames]
}
if (check.object(moduleNames)) {
var names = Object.keys(moduleNames)
moduleNames = names
}
check.verify.array(moduleNames, 'expected module names array ' +
JSON.stringify(moduleNames))
return moduleNames
}
function hasText(text, search) {
la(check.string(text), 'missing text', text);
la(check.unemptyString(search), 'missing search', search);
var has = text.toLowerCase().indexOf(search) !== -1;
return has;
}
function parseMessage(str) {
la(check.string(str), 'expected string message', str);
var match = PATTERN.exec(str);
if (!match) {
return;
}
return {
firstLine: match[1],
type: match[2],
scope: match[4],
subject: match[5]
};
}
function isValidLicense(pkg) {
return check.string(pkg.license) ||
check.array(pkg.licenses);
}
function updateSource (functions, source, filename) {
la(is.string(source), 'missing source', source)
la(is.unemptyString(filename), 'missing filename', filename)
function instrument (node) {
if (!isFunction(node)) {
return
}
const label = functionLabel(node)
const data = functions[label]
if (!data) {
return
}
insertComments(node, node.params.map(param => {
return param.name + ':' + JSON.stringify(data[param.name])
}))
return values.every(function (keyword) {
if (!check.string(keyword)) {
grunt.log.error('every keyword should be a string, found', keyword);
return false;
}
return true;
});
},
if (!config) {
return;
}
var pkg = getPackage();
la(check.object(pkg), 'missing package', pkg);
if (hasEnabledOption(config) && !config.enabled) {
return;
}
var run = pkg[label] ||
config &&
config[label];
if (check.string(run)) {
run = [run];
}
log('tasks for label "%s" are', label, run);
return run;
}