Skip to main content

clone

Creates a shallow copy of the given object/value.

API

function clone<T>(obj: T): T;

Usage

import { clone } from '@feedzai/js-utilities';

const CHARACTER = {
name: 'Bart',
age: 9
}

const simpsons = [CHARACTER]

clone(CHARACTER) // => copy of CHARACTER
clone(simpsons) // => copy of simpsons