import { deepClone } from "https://deno.land/x/30_seconds_of_typescript@v1.0.1/util.ts";
Creates a deep clone of an object.
Use recursion.
Check if the passed object is null
and, if so, return null
.
Use Object.assign()
and an empty object ({}
) to create a shallow clone of the original.
Use Object.keys()
and Array.prototype.forEach()
to determine which key-value pairs need to be deep cloned.