@ocap/util
Version:
utils shared across multiple forge js libs, works in both node.js and browser
18 lines • 861 B
text/typescript
//#region src/get-list-field.d.ts
declare const getListField: (obj: $TSFixMe, key: string) => any;
/**
* Write a repeated field to its canonical (no-suffix) form and remove the
* jspb `xxxList` twin. Keeps pipe code insulated from protobuf vs CBOR
* provenance while ensuring only one source of truth remains on `obj`.
*
* ⚠️ Must use `delete` (not `= undefined`) — see CLAUDE.md Critical Lesson #1.
*/
declare const setListField: (obj: $TSFixMe, key: string, value: unknown) => void;
/**
* Remove both `xxx` and `xxxList` twins so the field is absent from any
* subsequent spread / pick / serialization. Mirrors `setListField` for
* the "clear" case. Uses `delete` for the same reason as `setListField`.
*/
declare const deleteListField: (obj: $TSFixMe, key: string) => void;
//#endregion
export { deleteListField, getListField, setListField };