openclaw
Version:
Multi-channel AI gateway with extensible messaging integrations
2 lines • 695 B
JavaScript
//!packages/normalization-core/src/record-coerce.ts
function isRecord(e){return e!==null&&typeof e===`object`&&!Array.isArray(e)}function isStringArray(e){return Array.isArray(e)&&e.every(e=>typeof e===`string`)}function asRecord(e){return asOptionalObjectRecord(e)??{}}function asOptionalRecord(e){return isRecord(e)?e:void 0}function asNullableRecord(e){return isRecord(e)?e:null}function asOptionalObjectRecord(e){return e&&typeof e===`object`?e:void 0}function omitUndefinedFields(e){for(const t in e)if(e[t]===void 0)delete e[t];return e}export{isRecord as a,asRecord as i,asOptionalObjectRecord as n,isStringArray as o,asOptionalRecord as r,omitUndefinedFields as s,asNullableRecord as t};