|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 12 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
283 bytes
|
| Line | |
|---|
| 1 | export function cloneDeep(value) {
|
|---|
| 2 | if (Array.isArray(value)) {
|
|---|
| 3 | return value.map((child) => cloneDeep(child))
|
|---|
| 4 | }
|
|---|
| 5 |
|
|---|
| 6 | if (typeof value === 'object' && value !== null) {
|
|---|
| 7 | return Object.fromEntries(Object.entries(value).map(([k, v]) => [k, cloneDeep(v)]))
|
|---|
| 8 | }
|
|---|
| 9 |
|
|---|
| 10 | return value
|
|---|
| 11 | }
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.