MCPcopy Index your code
hub / github.com/TypeStrong/ts-node / captureObjectState

Function captureObjectState

src/test/helpers.ts:280–290  ·  view source on GitHub ↗
(object: any, avoidGetters: string[] = [])

Source from the content-addressed store, hash-verified

278}
279
280function captureObjectState(object: any, avoidGetters: string[] = []) {
281 const descriptors = Object.getOwnPropertyDescriptors(object);
282 const values = mapValues(descriptors, (_d, key) => {
283 if (avoidGetters.includes(key)) return descriptors[key].value;
284 return object[key];
285 });
286 return {
287 descriptors,
288 values,
289 };
290}
291// Redefine all property descriptors and delete any new properties
292function resetObject(
293 object: any,

Callers 1

helpers.tsFile · 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…