@tuniao/tnui-vue3-uniapp
Version:
TuniaoUI for vue3 uniapp
13 lines (11 loc) • 312 B
text/typescript
import { MAX_SAFE_INTEGER, reIsUint } from './_common'
export function isIndex(value: any, length?: any) {
length = length == null ? MAX_SAFE_INTEGER : length
return (
!!length &&
(typeof value == 'number' || reIsUint.test(value)) &&
value > -1 &&
value % 1 == 0 &&
value < length
)
}