@reffuse/extension-query 0.1.4 #15

Merged
Thilawyn merged 340 commits from next into master 2025-05-26 04:15:01 +02:00
Showing only changes of commit df851cf9ee - Show all commits

View File

@@ -55,16 +55,20 @@ export const immutableSet = <T, const P extends Paths<T>>(
if (Option.isNone(child)) if (Option.isNone(child))
return child return child
if (Array.isArray(parent) && typeof key.value === "number") { if (Array.isArray(parent))
return Option.some([ return typeof key.value === "number"
...parent.slice(0, key.value), ? Option.some([
child.value, ...parent.slice(0, key.value),
...parent.slice(key.value + 1), child.value,
] as T) ...parent.slice(key.value + 1),
} ] as T)
: Option.none()
if (typeof parent === "object") if (typeof parent === "object")
return Option.some({ ...parent, [key.value]: child.value }) return Object.assign(
Object.create(Object.getPrototypeOf(parent)),
{ ...parent, [key.value]: child.value },
)
return Option.none() return Option.none()
} }