import type { Path } from "@thi.ng/api" ; import { illegalArgs } from "@thi.ng/errors/illegal-arguments" ; import { mutIn } from "./mut-in.js" ; /**
 * Similar to  mutInUnsafe , but takes any number of path-value
 * pairs as args and applies them in sequence using `mutInUnsafe()`.
 *
 *  remarks example param state param pairs export function mutInManyUnsafe < T > ( state , p1 , v1 ) ; export function mutInManyUnsafe < T > ( state , p1 , v1 , p2 , v2 ) ; export function mutInManyUnsafe < T > ( state , p1 , v1 , p2 , v2 , p3 , v3 ) ; export function mutInManyUnsafe < T > ( state , p1 , v1 , p2 , v2 , p3 , v3 , p4 , v4 ) ; export function mutInManyUnsafe < T > ( state , p1 , v1 , p2 , v2 , p3 , v3 , p4 , v4 , ... xs ) ; export function mutInManyUnsafe < T > ( state , ... pairs ) { const n = pairs . length ; n & 1 && illegalArgs ( `require even number of args (got ${ pairs . length })` ) ; for ( let i = 0 ; i < n && state ; i += 2 ) { state = mutIn ( state , pairs [ i ] , pairs [ i + 1 ] ) ; } return state ; }