本文整理汇总了TypeScript中lodash.startCase函数的典型用法代码示例。如果您正苦于以下问题:TypeScript startCase函数的具体用法?TypeScript startCase怎么用?TypeScript startCase使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了startCase函数的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的TypeScript代码示例。
示例1: getDefaultName
function getDefaultName(route: IRouterRoute): string {
const actionOpts = route.options as IActionRouteOptions
const action = startCase(actionOpts.type)
if (!route.kilnModel) return action
const singular = startCase(route.kilnModel.name)
const plural = startCase(route.kilnModel.meta.plural!)
return actionOpts.byList || actionOpts.type === ActionType.List
? `${action} ${plural}`
: `${action} ${singular}`
}
开发者ID:patrickhulce,项目名称:klay,代码行数:11,代码来源:paths.ts
示例2: setRouteDefaults
export function setRouteDefaults(route: RouteConfig, specific?: Partial<RouteConfig>) {
route = _.defaultsDeep(specific, defaultConfig, route);
if (!route.title) {
route.title = typeof route.route === "string"
? _.startCase(route.route)
: _.startCase(route.route[1]);
}
return route;
}
开发者ID:sketch7,项目名称:ssv-au-core,代码行数:12,代码来源:routing.util.ts
示例3: buildObjectSchema
function buildObjectSchema(
model: IModel,
cache?: ISwaggerSchemaCache,
name?: string,
): swagger.Schema {
const schema: swagger.Schema = {
type: 'object',
properties: {},
}
const required = []
const children = (model.spec.children as IModelChild[]) || []
for (const child of children) {
const childName = startCase(child.path).replace(/ +/g, '')
const childModel = transformSpecialCases(child.model, SwaggerContext.Schema)
schema.properties![child.path] = getSchema(childModel, cache, `${name}${childName}`)
if (childModel.spec.required) {
required.push(child.path)
}
}
if (required.length) {
schema.required = required
}
return schema
}
开发者ID:patrickhulce,项目名称:klay,代码行数:27,代码来源:components.ts
示例4: Date
inquirer.prompt(prompts).then(answers => {
if (!answers.moveon) {
return;
}
let today = new Date(),
year = today.getFullYear().toString();
answers.appVersion = [
'v0',
year.slice(2),
(today.getMonth() + 1) + padLeft(today.getDate())
].join('.');
answers.appNameSlug = _.slugify(answers.appName);
answers.appTitle = startCase(answers.appName).split(' ').join('');
answers.appYear = year;
gulp.src([
`${__dirname}/../templates/common/**`,
`${__dirname}/../templates/${answers.projectType}-package/**`
])
.pipe(template(answers))
.pipe(rename(file => {
if (file.basename[0] === '_') {
file.basename = '.' + file.basename.slice(1);
}
}))
.pipe(conflict('./'))
.pipe(gulp.dest('./'))
.on('end', () => {
this.log.info(`Successfully created LabShare ${answers.projectType} package...`);
});
});
开发者ID:LabShare,项目名称:lsc,代码行数:33,代码来源:package.ts
示例5:
const colorOptionsList = polygons.map(n => {
return {
key: `colors[${n}]`,
display: `${_.startCase(polygonNames.get(n))} Color`,
type: 'color',
default: defaultColors[n],
};
});
开发者ID:tessenate,项目名称:polyhedra-viewer,代码行数:8,代码来源:configOptions.ts
示例6: getUser
export function getUser (username) {
var user = JSON.parse(fs.readFileSync(getUserFilePath(username), {encoding: 'utf8'}));
user.name.full = _.startCase(user.name.first + ' ' + user.name.last);
_.keys(user.location).forEach(function (key) {
user.location[key] = _.startCase(user.location[key]);
});
return user;
};
开发者ID:wpcfan,项目名称:calltalent_server,代码行数:8,代码来源:helpers.ts
示例7: buildDetailsForFailure
export function buildDetailsForFailure(build: CircleCIBuild) {
return [
_.startCase(build.status),
'-',
timeAgo(build.stop_time),
'by',
build.committer_email
].join(' ');
}
开发者ID:jvandyke,项目名称:vscode-circleci,代码行数:9,代码来源:format.ts
示例8: buildSpecification
export function buildSpecification(kiln: IKiln, router: IRouter, overrides?: Partial<Spec>): Spec {
const schemaCache = new SwaggerSchemaCache()
for (const kilnModel of kiln.getModels()) {
const arrayModel = defaultModelContext.array().children(kilnModel.model)
getSchema(kilnModel.model, schemaCache, startCase(kilnModel.name))
getSchema(arrayModel, schemaCache, `${startCase(kilnModel.meta.plural)}List`)
}
return {
swagger: '2.0',
basePath: '/',
produces: ['application/json'],
host: 'localhost',
schemes: ['http'],
info: {
title: 'Title',
version: 'Version',
},
paths: buildPaths(router, schemaCache),
definitions: schemaCache.getUniqueSchemas(),
...overrides,
}
}
开发者ID:patrickhulce,项目名称:klay,代码行数:23,代码来源:spec.ts
示例9:
const copy = (file: string, dest: string) => {
this.fs.copyTpl(
this.templatePath(file + '.ejs'),
this.destinationPath('src', 'views', dest),
_.assign(
{},
this,
{
fileBase,
componentName: _.startCase(this.baseName).replace(/ /g, '')
},
)
)
}
开发者ID:damplus,项目名称:generator-plus,代码行数:14,代码来源:index.ts
示例10: findBySlug
export function findBySlug(
crops: CropLiveSearchResult[], slug?: string): CropLiveSearchResult {
const crop = find(crops, result => result.crop.slug === slug);
return crop || {
crop: {
name: startCase((slug || t("Name")).split("-").join(" ")),
slug: "slug",
binomial_name: t("Binomial Name"),
common_names: [t("Common Names")],
description: t("Description"),
sun_requirements: t("Sun Requirements"),
sowing_method: t("Sowing Method"),
processing_pictures: 0
},
image: DEFAULT_ICON
};
}
开发者ID:FarmBot,项目名称:Farmbot-Web-API,代码行数:17,代码来源:search_selectors.ts
示例11: run
async run(inputs: CommandLineInputs, options: CommandLineOptions): Promise<void> {
const { json } = options;
if (json) {
process.stdout.write(JSON.stringify(await this.env.getInfo()));
} else {
const results = await this.env.getInfo();
const groupedInfo: Map<InfoItemGroup, InfoItem[]> = new Map(
INFO_GROUPS.map((group): [typeof group, InfoItem[]] => [group, results.filter(item => item.group === group)])
);
const sortInfo = (a: InfoItem, b: InfoItem): number => {
if (a.key[0] === '@' && b.key[0] !== '@') {
return 1;
}
if (a.key[0] !== '@' && b.key[0] === '@') {
return -1;
}
return strcmp(a.key.toLowerCase(), b.key.toLowerCase());
};
const projectPath = this.project && this.project.directory;
const splitInfo = (ary: InfoItem[]) => ary
.sort(sortInfo)
.map((item): [string, string] => [` ${item.key}${item.flair ? ' ' + weak('(' + item.flair + ')') : ''}`, weak(item.value) + (item.path && projectPath && !item.path.startsWith(projectPath) ? ` ${weak('(' + item.path + ')')}` : '')]);
const format = (details: [string, string][]) => columnar(details, { vsep: ':' });
if (!projectPath) {
this.env.log.warn('You are not in an Ionic project directory. Project context may be missing.');
}
this.env.log.nl();
for (const [ group, info ] of groupedInfo.entries()) {
if (info.length > 0) {
this.env.log.rawmsg(`${strong(`${lodash.startCase(group)}:`)}\n\n`);
this.env.log.rawmsg(`${format(splitInfo(info))}\n\n`);
}
}
}
}
开发者ID:driftyco,项目名称:ionic-cli,代码行数:46,代码来源:info.ts
示例12: formatPermissionLabel
export function formatPermissionLabel(
plugin: GraclPlugin,
perm: string
): string {
const components = parsePermissionString(plugin, perm);
const obj = getPermissionObject(plugin, perm);
const format = obj && obj.format;
if (format) {
if (typeof format === 'string') {
return format;
} else {
return format(components.action, components.collection);
}
} else {
return startCase(perm);
}
}
开发者ID:CrossLead,项目名称:tyranid-gracl,代码行数:18,代码来源:formatPermissionLabel.ts
示例13: resolve
resolve(route: ActivatedRouteSnapshot) {
const path = route.params.name;
const text = _.startCase(path);
return [{ text: text, path: path }];
}
开发者ID:,项目名称:,代码行数:5,代码来源:
示例14: return
return (target: any) => {
metadata.define(symbols.atomConfig, _.defaults(context, { type: 'boolean', title: _.startCase(target.name), name: _.camelCase(target.name) }) , target);
};
开发者ID:OmniSharp,项目名称:atom-languageclient,代码行数:3,代码来源:decorators.ts
示例15: buildDetailsForGeneric
export function buildDetailsForGeneric(build: CircleCIBuild) {
return [
_.startCase(build.status),
].join(' ');
}
开发者ID:jvandyke,项目名称:vscode-circleci,代码行数:5,代码来源:format.ts
示例16: fromCamel
return function fromCamel(variableString:string):string {
return _.startCase(_.words(variableString).join(' '));
}
开发者ID:swordman1205,项目名称:angular-typescript-material,代码行数:3,代码来源:string.ts
示例17:
dates: _.mapValues(datesGrouped, (classifications: Array<Classification>) => classifications.map(classification => _.startCase(classification.label))),
开发者ID:fyndme,项目名称:bot-framework,代码行数:1,代码来源:helpers.ts
示例18: getClassifiedName
getClassifiedName(): string {
return _.startCase(_.camelCase(this.str)).replace(/ /g, '');
}
开发者ID:jkuri,项目名称:ng2-cli,代码行数:3,代码来源:string.ts
示例19:
_.keys(user.location).forEach(function (key) {
user.location[key] = _.startCase(user.location[key]);
});
开发者ID:wpcfan,项目名称:calltalent_server,代码行数:3,代码来源:helpers.ts
示例20: async
return async (dispatch: (action: any) => void, getState: () => GertyState, bundle: Bundle) => {
const state = getState();
const reference = state.data.workspace.repositories[relativePath];
if (!reference) {
throw new Error(`Repository ${relativePath} does not exist in the current workspace.`);
}
const manifestManager = bundle.container.get<ManifestManager>(gertyDomainSymbols.ManifestManager);
manifestManager.clearWatcher(relativePath);
if(!await manifestManager.repositoryExists(relativePath)) {
// todo: Does this go into it's own thunktor? I dunno! Probably!
const repositorySources = bundle.container
.getAllTagged<RepositorySource>(gertyDomainSymbols.RepositorySource, "source-type", sourceType);
const loads = repositorySources.map((repositorySource) =>
repositorySource.loadRepository(relativePath));
dispatch(addFlashMessage(`Grabbing ${relativePath} from ${_.startCase(reference.sourceType)}`));
const repositoryLoads = await Promise.all(loads);
dispatch(addFlashMessage(`${relativePath} Loaded from ${_.startCase(reference.sourceType)}`));
if(!repositoryLoads.some((load) => load)) {
throw new Error(`Unable to find the repository ${relativePath} locally or from any source.`);
}
}
const repository = await manifestManager.loadRepository(relativePath);
if (repository) {
dispatch({
type: "set-data-value",
path: `repositories.${relativePath}`,
value: repository,
} as SetDataValueAction);
manifestManager.watchRepository(relativePath, async () => {
dispatch(addFlashMessage(`Repository ${relativePath} changed, reloading.`));
const stops = _.map(repository.processes, (process, processId) =>
dispatch(stopProcess(buildGlobalProcessId(relativePath, processId))));
await Promise.all(stops);
await dispatch(loadRepository(relativePath, sourceUri, sourceType));
});
if (!state.data.workspace.repositories[relativePath]) {
dispatch({
type: "set-data-value",
path: "workspace.repositories",
value: _.merge(state.data.workspace.repositories, {
[relativePath]: {
relativePath,
sourceType,
sourceUri,
} as RepositoryReference,
}),
} as SetDataValueAction);
await dispatch(saveWorkspace());
}
return;
}
throw new Error("Unable to load repository.");
};
开发者ID:atrauzzi,项目名称:Gerty,代码行数:80,代码来源:LoadRepository.ts
注:本文中的lodash.startCase函数示例由纯净天空整理自Github/MSDocs等源码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。 |
请发表评论