deepCopy
export function deepCopy<T>(source: T): T
Description
The deepCopy
function creates a deep copy of the given source object, meaning that a new object is returned with all properties and nested properties of the original source copied.
This helper function is utilised throughout the framework to prevent settings from being shifted in-place.
Import
This function can be imported as such:
import { deepCopy } from '@unless/component-library.utils.helpers'
Parameters
Name | Type | Description |
---|---|---|
source | T | The object to be copied deeply. |
Return
This function returns a new object that is a deep copy of the source object. The returned object has the same structure as the original but is completely independent and can be modified without affecting the original object.
Updated over 1 year ago
What’s Next