From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- node_modules/csso/lib/utils/clone.js | 23 +++++++++++++++++++++++ 1 file changed, 23 insertions(+) create mode 100644 node_modules/csso/lib/utils/clone.js (limited to 'node_modules/csso/lib/utils/clone.js') diff --git a/node_modules/csso/lib/utils/clone.js b/node_modules/csso/lib/utils/clone.js new file mode 100644 index 00000000..7592e9e4 --- /dev/null +++ b/node_modules/csso/lib/utils/clone.js @@ -0,0 +1,23 @@ +var List = require('./list'); + +module.exports = function clone(node) { + var result = {}; + + for (var key in node) { + var value = node[key]; + + if (value) { + if (Array.isArray(value)) { + value = value.slice(0); + } else if (value instanceof List) { + value = new List(value.map(clone)); + } else if (value.constructor === Object) { + value = clone(value); + } + } + + result[key] = value; + } + + return result; +}; -- cgit v1.2.3