File tree Expand file tree Collapse file tree 4 files changed +53
-5
lines changed
Expand file tree Collapse file tree 4 files changed +53
-5
lines changed Original file line number Diff line number Diff line change @@ -33,9 +33,7 @@ Comb.prototype = {
3333 if ( config . hasOwnProperty ( option ) && config [ option ] && this . _options [ option ] ) {
3434 var handler ;
3535 try {
36- handler = require ( './options/' + option ) ;
37- handler . value = config [ option ] ;
38- this . _config [ option ] = handler ;
36+ this . _config [ option ] = require ( './options/' + option ) . setValue ( config [ option ] ) ;
3937 } catch ( e ) { }
4038 }
4139 }
Original file line number Diff line number Diff line change 1+ module . exports = {
2+
3+ _value : false ,
4+
5+ /**
6+ * Sets handler value.
7+ *
8+ * @param {String|Boolean } value Option value
9+ * @returns {Object }
10+ */
11+ setValue : function ( value ) {
12+ if ( ! value ) return this ;
13+ if ( typeof value === 'string' ) {
14+ this . _value = value ;
15+ } else {
16+ this . _value = 'after' ; // default
17+ }
18+ return this ;
19+ } ,
20+
21+ /**
22+ * Processes tree node.
23+ * @param {String } nodeType
24+ * @param {node } node
25+ */
26+ process : function ( nodeType , node ) {
27+ if ( nodeType === 'property' ) {
28+ if ( node [ node . length - 1 ] [ 0 ] === 's' ) node . pop ( ) ;
29+ if ( this . _value === 'both' || this . _value === 'before' )
30+ node . push ( [ 's' , ' ' ] ) ;
31+ }
32+ if ( nodeType === 'value' ) {
33+ if ( node [ 0 ] [ 0 ] === 's' ) node . shift ( ) ;
34+ if ( this . _value === 'both' || this . _value === 'after' )
35+ node . unshift ( [ 's' , ' ' ] ) ;
36+ }
37+ }
38+
39+ } ;
Original file line number Diff line number Diff line change @@ -2,6 +2,17 @@ module.exports = {
22
33 value : false ,
44
5+ /**
6+ * Sets handler value.
7+ *
8+ * @param {String|Boolean } value Option value
9+ * @returns {Object }
10+ */
11+ setValue : function ( value ) {
12+ this . _value = ! ! value ;
13+ return this ;
14+ } ,
15+
516 /**
617 * Processes tree node.
718 * @param {String } nodeType
Original file line number Diff line number Diff line change 4545 }
4646
4747 a {
48- top : 0 ;/* ololo */ margin : 0 ;}
48+ top : 0 ;/* ololo */ margin : 0 ;}
4949 b {
50- top : 0 /* trololo */ ;margin : 0 ;}
50+ top : 0 /* trololo */ ;margin : 0 ;}
5151
5252
5353
You can’t perform that action at this time.
0 commit comments