本文整理汇总了TypeScript中colors.grey函数的典型用法代码示例。如果您正苦于以下问题:TypeScript grey函数的具体用法?TypeScript grey怎么用?TypeScript grey使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了grey函数的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: leftLog
let check = (resultSet, subKey) => {
depth++;
// If there's no _meta, we need to recurse further
if (!resultSet._meta) {
leftLog(depth, '-', colors.underline.white(`${subKey}`));
Object.keys(resultSet).forEach(key => check(resultSet[key], key));
depth--;
return;
}
// If there's no reference property, this was the first time we saw this key
// So we need to check with the user to ensure that this is the right value
if (!resultSet.hasOwnProperty('reference')) {
leftLog(depth, colors.red(`X ${subKey}: No reference value found`));
// Not using template functions here so we're not calling .toString on objects
leftLog(depth + 1, colors.grey('Latest result:'), resultSet.current);
if (keyInYNStrict('Use this value?')) {
resultSet.reference = resultSet.current;
}
}
// If there is a reference property (checked above) and no current, then the test passed
// Move along, nothing to see here
if (!resultSet.hasOwnProperty('current')) {
leftLog(depth, `${greenCheckmark} ${subKey}`);
depth--;
return;
}
// If there are both current & reference properties, we need to ensure they match
// If not, a test failed and the user probably wants to update the value there
try {
deepStrictEqual(resultSet.reference, resultSet.current);
leftLog(depth, `${greenCheckmark} ${subKey}`);
} catch (e) {
leftLog(depth, colors.red(`X ${subKey}: Values don't match`));
// Not using template functions here so we're not calling .toString on objects
leftLog(depth + 1, colors.grey('Reference value:'), resultSet.reference);
leftLog(depth + 1, colors.grey('Latest result:'), resultSet.current);
if (keyInYNStrict('Should I replace this?')) {
resultSet.reference = resultSet.current;
delete resultSet.current;
}
}
depth--;
};
示例2: applyColor
function applyColor(message: string, color: Color): string {
if (!message) return;
if (!color) return message;
switch (color) {
case Color.black: return colors.black(message);
case Color.red: return colors.red(message);
case Color.green: return colors.green(message);
case Color.yellow: return colors.yellow(message);
case Color.blue: return colors.blue(message);
case Color.magenta: return colors.magenta(message);
case Color.cyan: return colors.cyan(message);
case Color.white: return colors.white(message);
case Color.grey: return colors.grey(message);
default: throw new Error('Invalid Color');
}
}
示例3: function
}, function (err) {
if (err) {
return next(err)
}
console.log('\n')
if (totalPassing > 0) {
console.log(colors.green(totalPassing + ' passing ') + colors.grey('(' + totalTime + 's)'))
}
if (totalFailing > 0) {
console.log(colors.red(totalFailing + ' failing'))
}
console.log('')
errors.forEach((error, index) => {
console.log(' ' + (index + 1) + ') ' + error.context + ' ' + error.value)
console.log('')
console.log(colors.red('\t error: ' + error.errMsg))
})
console.log('')
next()
})
示例4: grey
.map(tap(_ => console.log(green('We wrote ') + grey(self.outputFile))));