export function deepCopy<T>(source: T): T


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.


This function can be imported as such:

import { deepCopy } from '@unless/component-library.utils.helpers'


sourceTThe object to be copied deeply.


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.

What’s Next