source: trip-planner-front/node_modules/css-tree/lib/utils/clone.js@ 1ad8e64

Last change on this file since 1ad8e64 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 465 bytes
Line 
1var List = require('../common/List');
2
3module.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.