MCPcopy
hub / github.com/loggerhead/json4u / clone

Function clone

src/lib/utils.ts:22–28  ·  view source on GitHub ↗
(o: any)

Source from the content-addressed store, hash-verified

20}
21
22export function clone(o: any) {
23 if (typeof structuredClone !== "undefined") {
24 return structuredClone(o);
25 } else {
26 return JSON.parse(JSON.stringify(o));
27 }
28}
29
30// stolen from https://github.com/piotrwitek/utility-types/blob/master/src/mapped-types.ts#L77
31export type FunctionKeys<T extends object> = {

Callers

nothing calls this directly

Calls 1

stringifyMethod · 0.80

Tested by

no test coverage detected