本文整理汇总了TypeScript中lodash.capitalize函数的典型用法代码示例。如果您正苦于以下问题:TypeScript capitalize函数的具体用法?TypeScript capitalize怎么用?TypeScript capitalize使用的例子?那么恭喜您, 这里精选的函数代码示例或许可以为您提供帮助。
在下文中一共展示了capitalize函数的9个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: capitalize
(node: VariableNode, resources: ResourceIndex): DropDownItem => {
if (node.kind === "parameter_declaration") {
return { label: capitalize(node.args.label), value: "?" };
}
const { data_value } = node.args;
switch (data_value.kind) {
case "coordinate":
const { x, y, z } = data_value.args;
return { label: `Coordinate (${x}, ${y}, ${z})`, value: "?" };
case "identifier":
return { label: capitalize(data_value.args.label), value: "?" };
// tslint:disable-next-line:no-any
case "every_point" as any:
const { every_point_type } = (data_value as unknown as EveryPointShape).args;
return everyPointDDI(safeEveryPointType(every_point_type));
case "point":
const { pointer_id, pointer_type } = data_value.args;
const pointer =
findPointerByTypeAndId(resources, pointer_type, pointer_id);
return formatPoint(pointer);
case "tool":
const toolName = findToolById(resources, data_value.args.tool_id)
.body.name || "Untitled tool";
return { label: toolName, value: "X" };
// tslint:disable-next-line:no-any // Empty, user must make a selection.
case "nothing" as any:
return NO_VALUE_SELECTED_DDI();
}
throw new Error("WARNING: Unknown, possibly new data_value.kind?");
};
示例2: getFunctionsEventProvider
export function getFunctionsEventProvider(eventType: string): string {
// Legacy event types:
const parts = eventType.split("/");
if (parts.length > 1) {
const provider = _.last(parts[1].split("."));
return _.capitalize(provider);
}
// New event types:
if (eventType.match(/google.pubsub/)) {
return "PubSub";
} else if (eventType.match(/google.storage/)) {
return "Storage";
} else if (eventType.match(/google.analytics/)) {
return "Analytics";
} else if (eventType.match(/google.firebase.database/)) {
return "Database";
} else if (eventType.match(/google.firebase.auth/)) {
return "Auth";
} else if (eventType.match(/google.firebase.crashlytics/)) {
return "Crashlytics";
} else if (eventType.match(/google.firestore/)) {
return "Firestore";
}
return _.capitalize(eventType.split(".")[1]);
}
示例3:
name.split(/[ ]+/g).map(word => {
word = word.replace(/DR\./, 'Drive')
word = word.replace(/ST\./, 'Street')
word = word.replace(/RD\./, 'Road')
word = word.replace(/W\./, 'West')
word = word.replace(/\\/g, '/')
word = word.replace(/H\.S\./, 'High School')
if (!word.match(/[\.\d]/)) word = capitalize(word)
if (word.match(/^\(/)) word = `(${ capitalize(word.slice(1))}`
words.push(word)
})
示例4: parseFunctionMetadata
export function parseFunctionMetadata({ prefixMap, name }) {
let typeName;
let methodName;
const matchedPrefix = Object.keys(prefixMap).find(
prefix => name.indexOf(prefix) === 0
);
if (matchedPrefix) {
typeName = prefixMap[matchedPrefix];
methodName = camelCase(name.replace(matchedPrefix, ''));
} else {
// The type name is the word before the first dash capitalized. If the type
// is Vim, then it a editor-global method which will be attached to the Nvim
// class.
const parts = name.split('_');
typeName = capitalize(parts[0]);
methodName = camelCase(
(typeName === 'Ui' ? parts : parts.slice(1)).join('_')
);
}
return {
typeName,
methodName,
};
}
示例5: capitalize
const mapper = (v: string, k: string) => {
// "Reason: Explanation lorem ipsum dolor ipsum."
const reason = capitalize(("" + k).split("_").join(" "));
const explanation = v.toString();
return t(`${reason}: ${explanation}`);
};
示例6:
export const sendActivateAccountEmail = (request: any, response: any, next: NextErr) => {
console.log(`
Sending email to: ${request.body.firstname},
emailaddress: ${request.body.emailaddress},
authorization: ${request.body.authorization}`);
const email = {
from: process.env.DO_NOT_REPLY,
to: request.body.emailaddress,
subject: 'Activate Tsawwassen Tennis Club Membership',
html: `Hello ${_.capitalize(request.body.firstname)},
<br><br>
The Tsawwassen Tennis Club website has received an application for you to join our club.
Our apologies if this message was sent in error.
<br><br>
<a href="${fullUrl(request)}/#/activate-account?authorization=${request.body.authorization}">Click here to activate your account</a>
<br><br>
<b>Tswassasen Tennis Club</b>
<br>
<a href="${fullUrl(request)}/#/contact-us">Contact Us</a>
<br>`
}
mailgun.messages().send(email)
.then((data) => response.end())
.catch(next);
}
示例7:
.map(x => {
return {
label: `${x.headingId}: ${x.label}`,
value: x.value,
headingId: _.capitalize(x.headingId)
};
});
示例8: humanize
.map(key => {
const value = player.extra[key] as string[];
return popupHelpers.createGeneralInformation(
humanize(key),
_.capitalize((Array.isArray(value) ? value[0] : value).trim())
);
})
示例9: async
const fetchIds = async (mt: MediaType, extId: string) => {
const base = Airtable.base(config[mt].baseId)
const records = await base(capitalize(config[mt].table))
.select({ view: config[mt].view })
.all()
return records.map((record: any) => record.fields[extId])
}