本文整理汇总了TypeScript中chalk.white.bold方法的典型用法代码示例。如果您正苦于以下问题:TypeScript white.bold方法的具体用法?TypeScript white.bold怎么用?TypeScript white.bold使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类chalk.white
的用法示例。
在下文中一共展示了white.bold方法的6个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1:
this.project.documents.entries.forEach((document: Document) => {
console.log(
' ',
chalk.gray('Format:'),
chalk.white.bold(document.format)
)
console.log(' ', chalk.gray('Path:'), chalk.white.bold(document.path))
console.log('')
})
示例2: log
export function log( type: 'title' | 'success' | 'error' | 'step' | 'substep' | 'default' = 'default', message: string = '' ): void {
switch( type ) {
case 'title':
console.log( chalk.white.bold.underline( message ) );
break;
case 'success':
console.log( chalk.green.bold( message ) );
break;
case 'error':
console.log( chalk.red.bold( message ) );
break;
case 'step':
console.log( chalk.white.bold( ` ${ message }` ) );
break;
case 'substep':
console.log( chalk.gray( ` ${ arrowSymbol } ${ message }` ) );
break;
default:
console.log( message );
}
}
示例3: getCallbackId
const sendRequest = <DataT extends object | undefined>(
method: string, path: string, data?: DataT, authenticating: boolean = false
) => {
// Pre-checks
if (!authenticating && !socket().isConnected()) {
logger.warn(`Attempting to send request on a non-authenticated socket: ${path}`);
return Promise.reject('Not authorized');
}
if (!socket().nativeSocket) {
logger.warn(`Attempting to send request without a socket: ${path}`);
return Promise.reject('No socket');
}
const callbackId = getCallbackId();
// Reporting
invariant(path, 'Attempting socket request without a path');
const ignored = eventIgnored(path, ignoredRequestPaths);
if (!ignored) {
logger.verbose(
chalk.white.bold(callbackId.toString()),
method,
path,
data ? filterPassword(data) : '(no data)'
);
}
// Callback
const resolver = Promise.pending();
callbacks[callbackId] = {
time: new Date().getTime(),
resolver,
ignored,
};
// Actual request
const request = {
path,
method,
data,
callback_id: callbackId,
} as APIInternal.OutgoingRequest;
socket().nativeSocket!.send(JSON.stringify(request));
return resolver.promise;
};
示例4: echoStatus
public echoStatus(prefix: string, statusText: string) {
console.log(chalk.white.bold(prefix), chalk.green(statusText));
}
示例5:
matches.forEach(function (match) {
const extracted = match.replace(/(^\*)|(\*$)/g, '')
text = text.replace(match, '' + chalk.white.bold(extracted))
})
示例6: log
public log() {
const translationsCount = this.project.revisions.reduce(
(memo, revision: Revision) => memo + revision.translationsCount,
0
)
const conflictsCount = this.project.revisions.reduce(
(memo, revision: Revision) => memo + revision.conflictsCount,
0
)
const reviewedCount = this.project.revisions.reduce(
(memo, revision: Revision) => memo + revision.reviewedCount,
0
)
console.log(chalk.magenta('Last synced'))
console.log(' ', chalk.white.bold(this.project.lastSyncedAt))
console.log('')
console.log(chalk.magenta('Master language'))
console.log(
' ',
chalk.white.bold(this.project.language.name) +
' – ' +
this.project.language.slug
)
console.log('')
if (this.project.revisions.length > 1) {
console.log(
chalk.magenta(`Translations (${this.project.revisions.length - 1})`)
)
this.project.revisions.forEach((revision: Revision) => {
if (this.project.language.id !== revision.language.id) {
console.log(
' ',
chalk.white.bold(revision.language.name) +
' – ' +
revision.language.slug
)
console.log('')
}
})
}
console.log(chalk.magenta('Documents'))
this.project.documents.entries.forEach((document: Document) => {
console.log(
' ',
chalk.gray('Format:'),
chalk.white.bold(document.format)
)
console.log(' ', chalk.gray('Path:'), chalk.white.bold(document.path))
console.log('')
})
console.log(chalk.magenta('Strings'))
console.log(
' ',
chalk.white('# Strings:'),
chalk.white(`${translationsCount}`)
)
console.log(
' ',
chalk.green('✓ Reviewed:'),
chalk.green(`${reviewedCount}`)
)
console.log(' ', chalk.red('× In review:'), chalk.red(`${conflictsCount}`))
}