MCPcopy Create free account
hub / github.com/MetaMask/rpc-errors / serializeObject

Function serializeObject

src/utils.ts:232–244  ·  view source on GitHub ↗

* Extracts all JSON-serializable properties from an object. * * @param object - The object in question. * @returns An object containing all the JSON-serializable properties.

(object: RuntimeObject)

Source from the content-addressed store, hash-verified

230 * @returns An object containing all the JSON-serializable properties.
231 */
232function serializeObject(object: RuntimeObject): Json {
233 return Object.getOwnPropertyNames(object).reduce<Record<string, Json>>(
234 (acc, key) => {
235 const value = object[key];
236 if (isValidJson(value)) {
237 acc[key] = value;
238 }
239
240 return acc;
241 },
242 {},
243 );
244}
245
246/**
247 * Returns true if supplied error data has a usable `cause` property; false otherwise.

Callers 1

serializeCauseFunction · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…