minor bugfix (x2)

This commit is contained in:
Chris Wanstrath 2025-11-09 14:36:52 -08:00
parent d4596c3afa
commit f8718ac05b

View File

@ -1,7 +1,7 @@
import { type Value, toValue, toNull } from 'reefvm'
export const list = {
slice: (list: any[], start: number, end?: number) => list.slice(start, end),
slice: (list: any[], start: number, end?: number) => list.slice(start, end ? end : undefined),
map: async (list: any[], cb: Function) => {
let acc: any[] = []
for (const value of list) acc.push(await cb(value))
@ -70,8 +70,7 @@ export const list = {
const realList = list.value as any[]
const realStart = start.value as number
const realDeleteCount = deleteCount.value as number
const realItems = items.map(item => item.value)
return toValue(realList.splice(realStart, realDeleteCount, ...realItems))
return toValue(realList.splice(realStart, realDeleteCount, ...items))
},
insert: (list: Value, index: Value, item: Value) => {
if (list.type !== 'array') return toNull()