main
Last change
on this file was 79a0317, checked in by stefan toskovski <stefantoska84@…>, 4 days ago |
F4 Finalna Verzija
|
-
Property mode
set to
100644
|
File size:
768 bytes
|
Line | |
---|
1 | var wrapSingle = require('./wrap-for-optimizing').single;
|
---|
2 |
|
---|
3 | var Token = require('../tokenizer/token');
|
---|
4 |
|
---|
5 | function deep(property) {
|
---|
6 | var cloned = shallow(property);
|
---|
7 | for (var i = property.components.length - 1; i >= 0; i--) {
|
---|
8 | var component = shallow(property.components[i]);
|
---|
9 | component.value = property.components[i].value.slice(0);
|
---|
10 | cloned.components.unshift(component);
|
---|
11 | }
|
---|
12 |
|
---|
13 | cloned.dirty = true;
|
---|
14 | cloned.value = property.value.slice(0);
|
---|
15 |
|
---|
16 | return cloned;
|
---|
17 | }
|
---|
18 |
|
---|
19 | function shallow(property) {
|
---|
20 | var cloned = wrapSingle([
|
---|
21 | Token.PROPERTY,
|
---|
22 | [Token.PROPERTY_NAME, property.name]
|
---|
23 | ]);
|
---|
24 | cloned.important = property.important;
|
---|
25 | cloned.hack = property.hack;
|
---|
26 | cloned.unused = false;
|
---|
27 | return cloned;
|
---|
28 | }
|
---|
29 |
|
---|
30 | module.exports = {
|
---|
31 | deep: deep,
|
---|
32 | shallow: shallow
|
---|
33 | };
|
---|
Note:
See
TracBrowser
for help on using the repository browser.