Skip to content

Commit b9865cc

Browse files
committed
refactor visitor with .type
1 parent 3c00f86 commit b9865cc

File tree

2 files changed

+2
-9
lines changed

2 files changed

+2
-9
lines changed

index.js

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,7 @@ Compiler.prototype.compile = function(node){
3636
*/
3737

3838
Compiler.prototype.visit = function(node){
39-
if ('page' == node.type) return this.page(node);
40-
if (node.document) return this.document(node);
41-
if (node.comment) return this.comment(node);
42-
if (node.charset) return this.charset(node);
43-
if (node.keyframes) return this.keyframes(node);
44-
if (node.media) return this.media(node);
45-
if (node.import) return this.import(node);
46-
return this.rule(node);
39+
return this[node.type](node);
4740
};
4841

4942
/**

package.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
"devDependencies": {
88
"mocha": "*",
99
"should": "*",
10-
"css-parse": "1.3.0"
10+
"css-parse": "1.4.0"
1111
},
1212
"main": "index"
1313
}

0 commit comments

Comments
 (0)