本文整理汇总了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 失败:未知项目类型,无法继续创建')
}
}
开发者ID:bbxyard,项目名称:bbxyard,代码行数:64,代码来源:new.ts
示例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)}`
);
}
});
开发者ID:castrors,项目名称:bloc,代码行数:33,代码来源:extension.ts
示例3: getDefaultBlocEventTemplate
function getDefaultBlocEventTemplate(blocName: string): string {
const pascalCaseBlocName = changeCase.pascalCase(blocName.toLowerCase());
return `import 'package:meta/meta.dart';
@immutable
abstract class ${pascalCaseBlocName}Event {}
`;
}
开发者ID:castrors,项目名称:bloc,代码行数:8,代码来源:bloc-event.template.ts
示例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 {}
`;
}
开发者ID:castrors,项目名称:bloc,代码行数:10,代码来源:bloc-state.template.ts
示例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
}
}
开发者ID:bbxyard,项目名称:bbxyard,代码行数:15,代码来源:Request.ts
示例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;
}
}
}));
}
开发者ID:RiseVision,项目名称:rise-node,代码行数:11,代码来源:bus.ts
示例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);
}
`;
}
开发者ID:castrors,项目名称:bloc,代码行数:11,代码来源:bloc-event.template.ts
示例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
}
}
`;
}
开发者ID:castrors,项目名称:bloc,代码行数:21,代码来源:bloc.template.ts
示例9: PascalCase
export function PascalCase(name: string): string {
return changeCase.pascalCase(name);
}
开发者ID:artifacthealth,项目名称:hydrate-mongodb,代码行数:4,代码来源:namingStrategies.ts
示例10: responseModel
public responseModel(language: string, name: string): string {
return renderModel(pascalCase(name), this.responseBody());
}
开发者ID:tylerlong,项目名称:rc-swagger-codegen,代码行数:3,代码来源:action.ts
注:本文中的change-case.pascalCase函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论