本文整理汇总了TypeScript中lodash.startCase函数的典型用法代码示例。如果您正苦于以下问题:TypeScript startCase函数的具体用法?TypeScript startCase怎么用?TypeScript startCase使用的例子?那么, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了startCase函数的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的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}`
}
示例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;
}
示例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
}
示例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...`);
});
});
示例5:
const colorOptionsList = polygons.map(n => {
return {
key: `colors[${n}]`,
display: `${_.startCase(polygonNames.get(n))} Color`,
type: 'color',
default: defaultColors[n],
};
});
示例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;
};
示例7: buildDetailsForFailure
export function buildDetailsForFailure(build: CircleCIBuild) {
return [
_.startCase(build.status),
'-',
timeAgo(build.stop_time),
'by',
build.committer_email
].join(' ');
}
示例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,
}
}
示例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, '')
},
)
)
}
示例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
};
}
示例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`);
}
}
}
}
示例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);
}
}
示例13: resolve
resolve(route: ActivatedRouteSnapshot) {
const path = route.params.name;
const text = _.startCase(path);
return [{ text: text, path: path }];
}
示例14: return
return (target: any) => {
metadata.define(symbols.atomConfig, _.defaults(context, { type: 'boolean', title: _.startCase(target.name), name: _.camelCase(target.name) }) , target);
};
示例15: buildDetailsForGeneric
export function buildDetailsForGeneric(build: CircleCIBuild) {
return [
_.startCase(build.status),
].join(' ');
}