本文整理汇总了TypeScript中change-case.pascalCase函数的典型用法代码示例。如果您正苦于以下问题:TypeScript pascalCase函数的具体用法?TypeScript pascalCase怎么用?TypeScript pascalCase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了pascalCase函数的10个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: newScaffold
/**
* 新建脚手架模板
*
* @param {NewAnswers} answers
*/
private async newScaffold (answers: NewAnswers) {
let { pkgName = '', pageName = '', title = '' } = answers
let pkgNameSuffix = util.getRealPageName(pkgName) // loading
let date = new Date()
// 模板变量
let newData: NewData = {
npmScopeStr: filterNpmScope(config.npm.scope),
version: '1.0.0',
pkgName, // wxc-loading
pkgNameToPascalCase: changeCase.pascalCase(pkgName), // WxcLoading
pkgNameSuffix, // loading
pkgNameSuffixToPascalCase: changeCase.pascalCase(pkgNameSuffix), // Loading
pageName, // home
pageNameToPascalCase: changeCase.pascalCase(pageName), // Home
title, // 组件名称
description: `${title} - 小程序组件`, // 组件描述
isPlugin: answers.plugin,
time: date.getFullYear() + '-' + (date.getMonth() + 1) + '-' + date.getDate()
}
switch (config.projectType) {
case ProjectType.Component: // 组件库
{
switch (answers.newType) {
case NewType.Package:
{
// 新建组件
await this.newPackage(newData)
}
break
case NewType.Page:
{
// 新建页面
await this.newPage(newData)
}
break
default:
return Promise.reject('Min New 失败:未知项目类型,无法继续创建')
}
}
break
case ProjectType.Application: // 小程序应用
{
// 新建页面
await this.newPage(newData)
}
break
default:
return Promise.reject('Min New 失败:未知项目类型,无法继续创建')
}
}
示例2: async
commands.registerCommand("extension.new-bloc", async (uri: Uri) => {
const blocName = await promptForBlocName();
if (_.isNil(blocName) || blocName.trim() === "") {
window.showErrorMessage("The bloc name must not be empty");
return;
}
let targetDirectory;
if (_.isNil(_.get(uri, "fsPath")) || !lstatSync(uri.fsPath).isDirectory()) {
targetDirectory = await promptForTargetDirectory();
if (_.isNil(targetDirectory)) {
window.showErrorMessage("Please select a valid directory");
return;
}
} else {
targetDirectory = uri.fsPath;
}
const useEquatable = (await promptForUseEquatable()) === "yes (advanced)";
const pascalCaseBlocName = changeCase.pascalCase(blocName.toLowerCase());
try {
await generateBlocCode(blocName, targetDirectory, useEquatable);
window.showInformationMessage(
`Successfully Generated ${pascalCaseBlocName} Bloc`
);
} catch (error) {
window.showErrorMessage(
`Failed to Generate ${pascalCaseBlocName} Bloc
${JSON.stringify(error)}`
);
}
});
示例3: getDefaultBlocEventTemplate
function getDefaultBlocEventTemplate(blocName: string): string {
const pascalCaseBlocName = changeCase.pascalCase(blocName.toLowerCase());
return `import 'package:meta/meta.dart';
@immutable
abstract class ${pascalCaseBlocName}Event {}
`;
}
示例4: getDefaultBlocStateTemplate
function getDefaultBlocStateTemplate(blocName: string): string {
const pascalCaseBlocName = changeCase.pascalCase(blocName.toLowerCase());
return `import 'package:meta/meta.dart';
@immutable
abstract class ${pascalCaseBlocName}State {}
class Initial${pascalCaseBlocName}State extends ${pascalCaseBlocName}State {}
`;
}
示例5: constructor
/**
* Creates an instance of RequestExtend.
* @param {Request.Options} options
* @memberof RequestExtend
*/
constructor (options: Request.Options) {
super(options)
// 通过扩展名,取得key值
let key = _.findKey(config.ext, value => value === this.ext)
if (key) {
// 通过 key 值,设置实例中对应字段的真值,其余都为假值
this[`is${changeCase.pascalCase(key)}`] = true
}
}
示例6: message
public async message(event: string, ...rest: any[]) {
const methodToCall = `on${changeCase.pascalCase(event)}`;
await Promise.all(this.modules.map(async (module) => {
if (typeof(module[methodToCall]) === 'function') {
const toRet = module[methodToCall].apply(module, rest);
if (toRet instanceof Promise) {
await toRet;
}
}
}));
}
示例7: getEquatableBlocEventTemplate
function getEquatableBlocEventTemplate(blocName: string): string {
const pascalCaseBlocName = changeCase.pascalCase(blocName.toLowerCase());
return `import 'package:equatable/equatable.dart';
import 'package:meta/meta.dart';
@immutable
abstract class ${pascalCaseBlocName}Event extends Equatable {
${pascalCaseBlocName}Event([List props = const []]) : super(props);
}
`;
}
示例8: getBlocTemplate
export function getBlocTemplate(blocName: string): string {
const pascalCaseBlocName = changeCase.pascalCase(blocName.toLowerCase());
const blocState = `${pascalCaseBlocName}State`;
const blocEvent = `${pascalCaseBlocName}Event`;
return `import 'dart:async';
import 'package:bloc/bloc.dart';
import './bloc.dart';
class ${pascalCaseBlocName}Bloc extends Bloc<${blocEvent}, ${blocState}> {
@override
${blocState} get initialState => Initial${blocState}();
@override
Stream<${blocState}> mapEventToState(
${blocEvent} event,
) async* {
// TODO: Add Logic
}
}
`;
}
示例9: PascalCase
export function PascalCase(name: string): string {
return changeCase.pascalCase(name);
}
示例10: responseModel
public responseModel(language: string, name: string): string {
return renderModel(pascalCase(name), this.responseBody());
}