本文整理汇总了TypeScript中lodash.upperFirst函数的典型用法代码示例。如果您正苦于以下问题:TypeScript upperFirst函数的具体用法?TypeScript upperFirst怎么用?TypeScript upperFirst使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了upperFirst函数的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: getAST
export const addModuleToState = (pathToAppActions: string, moduleName: string): void => {
try {
let file = fs.readFileSync(pathToAppActions, 'utf-8');
getAST(file);
file = insertAt(
file,
findAstNodes(sourceFile, ts.SyntaxKind.ObjectLiteralExpression, true).pop().end + 1,
`\n ${lowerFirst(moduleName)}: {\n ...${upperFirst(moduleName)}DefaultState,\n },`,
);
const interfaces: ts.Node[] = findAstNodes(sourceFile, ts.SyntaxKind.InterfaceDeclaration, true);
file = insertAt(
file,
interfaces.shift().end - 2,
`\n ${lowerFirst(moduleName)}?: I${upperFirst(moduleName)}State;`,
);
file = insertAt(
file,
findAstNodes(sourceFile, ts.SyntaxKind.ImportDeclaration, true).pop().end,
`\nimport { ${upperFirst(moduleName)}DefaultState, I${upperFirst(moduleName)}State } from './${lowerFirst(moduleName)}/state';`,
);
fs.writeFileSync(pathToAppActions, file, { encoding: 'utf-8' });
} catch (e) {
throw new Error(e);
}
};
示例2: init
(async function init() {
for (const commandPath of commandsPath) {
const className = upperFirst(camelCase(commandPath.replace(/\./g, '-')));
if (
process.env.NODE_ENV !== 'production' &&
filter &&
`${filter}.command` !== commandPath
) {
continue;
}
const classInterface = (await import(`./commands/${commandPath}`))[
className
];
const commandObject = new classInterface();
try {
yargs.command(commandObject);
} catch (e) {
console.log('ERROR ON COMMAND');
console.log(e);
}
}
yargs
.demandCommand(1)
.strict()
.help('h')
.alias('v', 'version').argv;
})();
示例3: upperFirst
.map((response:any) => {
var result = response.json(),
name = result.name;
result.img = 'http://img.pokemondb.net/artwork/' + name + '.jpg';
result.name = upperFirst(name);
cache.pokemon.set(id, result);
return result;
});
示例4: welcomeOAuth
public async welcomeOAuth(requestState: RequestState, user: UserDocument): Promise<SentMessageInfo> {
const strategyNames: { [key: string]: string } = {
github: 'GitHub',
google: 'Google',
gameex: 'GameEx',
};
return this.sendEmail(requestState, user, 'Welcome to VPDB!', 'welcome-oauth', {
user,
profileUrl: settings.webUri('/profile/settings'),
strategy: strategyNames[user.provider] || upperFirst(user.provider),
});
}
示例5: constructor
constructor(private config: IComponentGenConfig) {
const className = upperFirst(camelCase(config.name));
let path = `${Vesta.directories.components}/${config.path}`;
mkdir(path);
if (this.config.hasStyle) {
genSass(className, path);
}
if (config.model) {
path = `${path}/${className}`;
}
}
示例6: addProperty
addProperty(layoutElements: {}[], property: {}, name: string, path: string) {
if (property['type'] == 'object') {
let sublayout: {} = {
'type': 'Group',
'label': _.upperFirst(name),
'elements': []
};
_.forEach(property['properties'], (subproperty: any, subname: string) => {
this.addProperty(sublayout['elements'], subproperty, subname, path + name + '/properties/');
});
layoutElements.push(sublayout);
} else {
let control: {} = {
'type': 'Control',
'label': _.upperFirst(name),
'scope': {
'$ref': path + name
}
};
layoutElements.push(control);
}
}
示例7: validate
public validate(
_pipeline: IPipeline,
stage: IStage | ITrigger,
validationConfig: IServiceFieldValidatorConfig,
): string {
const serviceInput: ICloudFoundryServiceManifestSource = get(stage, 'manifest');
if (sourceType(serviceInput, get(stage, 'userProvided')) !== validationConfig.manifestSource) {
return null;
}
const manifestSource: any = get(serviceInput, sourceStruct(serviceInput));
const content: any = get(manifestSource, validationConfig.fieldName);
const fieldLabel = validationConfig.fieldLabel || upperFirst(validationConfig.fieldName);
return content ? null : `<strong>${fieldLabel}</strong> is a required field for the Deploy Service stage.`;
}
示例8:
return this.$q.all(promises).then(results => {
let status = 'success';
let message = '';
for (let i = 0; i < results.length; i++) {
if (results[i].status !== 'success') {
status = results[i].status;
}
message += `${i + 1}. ${results[i].message} `;
}
return {
status: status,
message: message,
title: _.upperFirst(status),
};
});