本文整理匯總了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))
}