* 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)
| 230 | * @returns An object containing all the JSON-serializable properties. |
| 231 | */ |
| 232 | function 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. |
no outgoing calls
no test coverage detected
searching dependent graphs…