zgg-ui
Version:
2.0.1 正式版本 基于 Vue 3、UniApp 和 TypeScript 开发的多端适配移动端 UI 组件库,旨在提供丰富的组件集合,帮助开发者快速构建多端响应式的移动应用界面
21 lines (18 loc) • 463 B
text/typescript
export function baseSlice(array: string[], start: number, end: number) {
let index = -1
let length = array.length
if (start < 0) {
start = -start > length ? 0 : length + start
}
end = end > length ? length : end
if (end < 0) {
end += length
}
length = start > end ? 0 : (end - start) >>> 0
start >>>= 0
const result = Array.from({ length })
while (++index < length) {
result[index] = array[index + start]
}
return result
}