本文整理匯總了TypeScript中underscore.string.humanize方法的典型用法代碼示例。如果您正苦於以下問題:TypeScript string.humanize方法的具體用法?TypeScript string.humanize怎麽用?TypeScript string.humanize使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類underscore.string
的用法示例。
在下文中一共展示了string.humanize方法的6個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的TypeScript代碼示例。
示例1: mustNotExceedMaxLenth
export function mustNotExceedMaxLenth(attribute: string, maxLength: number) {
return `${s.humanize(attribute)} must not exceed length ${maxLength}`;
}
示例2: mustContainString
export function mustContainString(attribute: string, requiredString: string) {
return `${s.humanize(attribute)} must contain the string '${requiredString}'`;
}
示例3: mustBePositiveNumber
export function mustBePositiveNumber(attribute: string) {
return `${s.humanize(attribute)} must be a positive integer`;
}
示例4: mustBeAUrl
export function mustBeAUrl(attribute: string) {
return `${s.humanize(attribute)} must be a valid http(s) url`;
}
示例5: mustBePresent
export function mustBePresent(attribute: string) {
return `${s.humanize(attribute).replace(/\bxpath\b/i, "XPath").replace(/\burl\b/i, "URL")} must be present`;
}
示例6: duplicate
export function duplicate(attribute: string) {
return `${s.humanize(attribute)} is a duplicate`;
}