Changelog - 2026-11-07
RecordUtility.read, a safe deep read that answers undefined
FeatureIn one line. Code that reads an unknown payload no longer needs a try/catch or its own reader: RecordUtility.read({ value, path }) answers the value at the path, or undefined.
What changed
RecordUtility.read({ value, path })in@venizia/ignis-helpersand@venizia/ignis-helpers/core.pathis an array of keys; a number reads an array index.- Answers
undefinedwhen any step is missing,nullor not an object.ParseUtility.getDeepPropertythrows on anullstep; it is unchanged. - Own properties only.
__proto__,constructor,toStringand the like are never found through the prototype, so a path taken from input cannot reach the prototype chain. A key that the data itself owns, such as one parsed from JSON, is read. - Empty path. Answers
valueitself. The answer isunknown: narrow it with a guard.
ts
const city = RecordUtility.read({ value: payload, path: ['user', 'address', 'city'] });
if (typeof city === 'string') {
// ...
}Who is affected
Nobody needs to act. It adds a method.
Details
| File | Package |
|---|---|
src/utilities/record.utility.ts | helpers |