Skip to main content
Deno 2 is finally here 🎉️
Learn more
Module

x/froebel/equality.ts>clone

A strictly typed utility library.
Go to Latest
variable clone
import { clone } from "https://deno.land/x/froebel@v0.18.0/equality.ts";

Returns a copied version of value.

If value is primitive, returns value. Otherwise, properties of value are copied recursively. Only value's own enumerable properties are cloned. Arrays are cloned by mapping over their elements.

If a path in value references itself or a parent path, then in the resulting object that path will also reference the path it referenced in the original object (but now in the resuling object instead of the original).

type

<T>(value: T) => T