|
Last change
on this file was 9af201e, checked in by MBK <marija.karapandzova@…>, 11 days ago |
|
Fix frontend appearance
|
-
Property mode
set to
100644
|
|
File size:
465 bytes
|
| Line | |
|---|
| 1 | var List = require('../common/List');
|
|---|
| 2 |
|
|---|
| 3 | module.exports = function clone(node) {
|
|---|
| 4 | var result = {};
|
|---|
| 5 |
|
|---|
| 6 | for (var key in node) {
|
|---|
| 7 | var value = node[key];
|
|---|
| 8 |
|
|---|
| 9 | if (value) {
|
|---|
| 10 | if (Array.isArray(value) || value instanceof List) {
|
|---|
| 11 | value = value.map(clone);
|
|---|
| 12 | } else if (value.constructor === Object) {
|
|---|
| 13 | value = clone(value);
|
|---|
| 14 | }
|
|---|
| 15 | }
|
|---|
| 16 |
|
|---|
| 17 | result[key] = value;
|
|---|
| 18 | }
|
|---|
| 19 |
|
|---|
| 20 | return result;
|
|---|
| 21 | };
|
|---|
Note:
See
TracBrowser
for help on using the repository browser.