当前位置: 首页>>代码示例>>TypeScript>>正文


TypeScript colors.grey函数代码示例

本文整理汇总了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--;
};
开发者ID:SomeKittens,项目名称:baddsert,代码行数:47,代码来源:cli.ts

示例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');
    }
}
开发者ID:herculesinc,项目名称:credo.logger,代码行数:17,代码来源:ConsoleLogger.ts

示例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()
            })
开发者ID:0mkara,项目名称:remix,代码行数:23,代码来源:runTestFiles.ts

示例4: grey

 .map(tap(_ => console.log(green('We wrote ') + grey(self.outputFile))));
开发者ID:hrajchert,项目名称:mddoc,代码行数:1,代码来源:custom-generator.ts


注:本文中的colors.grey函数示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。