docs
evals
scenario-1
scenario-10
scenario-2
scenario-3
scenario-4
scenario-5
scenario-6
scenario-7
scenario-8
scenario-9
Create a small helper module for reading, writing, updating, and removing values inside nested objects or arrays using property paths.
{ user: { profile: { name: "Ava" } } }, reading "user.profile.name" returns "Ava", while reading "user.profile.age" with a default of 30 returns 30. @test["settings", "themes", 0], it returns the value at that location if present. @test"#3366ff" to "appearance.palette.primary" creates intermediate objects if needed, stores the value on the original target, and returns that same target. @test"metrics.views" starts from the provided default when the path is missing, stores the updated number, and returns the mutated target. @test"session.cache.token" deletes the property from the target and reports success; repeating the call reports failure without throwing. @test/**
* Reads a value from a nested object/array using a string or string[] path,
* returning defaultValue when no value exists.
*/
export function readAtPath(target, path, defaultValue);
/**
* Writes value to target at the given path, creating intermediate objects/arrays
* as needed. Mutates and returns target.
*/
export function writeAtPath(target, path, value);
/**
* Applies updater to the current value at path (or defaultValue when missing),
* stores the result at that path, and returns the mutated target.
*/
export function updateAtPath(target, path, updater, defaultValue);
/**
* Removes the value at the given path. Returns true when a deletion occurred,
* otherwise false. Mutates target.
*/
export function removeAtPath(target, path);Utility toolkit for property-path reads, writes, updates, and deletions.