本文整理汇总了TypeScript中klay-core.IValidationResult类的典型用法代码示例。如果您正苦于以下问题:TypeScript IValidationResult类的具体用法?TypeScript IValidationResult怎么用?TypeScript IValidationResult使用的例子?那么, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了IValidationResult类的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的TypeScript代码示例。
示例1: parseFields
function parseFields(value: IValidationResult): IValidationResult {
if (typeof value.value === 'string') {
return value.setValue(value.value.split(',').map(s => s.split('.')))
} else if (Array.isArray(value.value)) {
const newArr = value.value.map(s => (typeof s === 'string' ? s.split('.') : s))
return value.setValue(newArr)
}
return value
}
示例2: parseOrder
function parseOrder(value: IValidationResult): IValidationResult {
if (typeof value.value === 'string') {
return value.setValue(value.value.split(',').map(stringToOrderItem))
} else if (Array.isArray(value.value)) {
const newArr = value.value.map(
item => (typeof item === 'string' ? stringToOrderItem(item) : (item as IQueryOrderItem)),
)
return value.setValue(newArr)
}
return value
}
示例3: parseQueryFilter
function parseQueryFilter(value: IValidationResult): IValidationResult {
if (typeof value.value === 'object' || typeof value.value === 'undefined') {
return value
}
return value.setValue({$eq: value.value})
}
示例4: return
return (result: IValidationResult): IValidationResult => {
// We don't need to update the password return early
if (result.value.match(hashedRegex)) return result
// We're accepting a user password, create a new hash/salt and set the value
return result.setValue(createNewPasswordHashSalt(result.value, options))
}