File tree Expand file tree Collapse file tree 3 files changed +31
-6
lines changed
Expand file tree Collapse file tree 3 files changed +31
-6
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 11module . exports = {
22
3- value : false ,
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+ } ,
420
521 /**
622 * Processes tree node.
@@ -10,12 +26,12 @@ module.exports = {
1026 process : function ( nodeType , node ) {
1127 if ( nodeType === 'property' ) {
1228 if ( node [ node . length - 1 ] [ 0 ] === 's' ) node . pop ( ) ;
13- if ( this . value === 'both' || this . value === 'before' )
29+ if ( this . _value === 'both' || this . _value === 'before' )
1430 node . push ( [ 's' , ' ' ] ) ;
1531 }
1632 if ( nodeType === 'value' ) {
1733 if ( node [ 0 ] [ 0 ] === 's' ) node . shift ( ) ;
18- if ( this . value === 'both' || this . value === 'after' )
34+ if ( this . _value === 'both' || this . _value === 'after' )
1935 node . unshift ( [ 's' , ' ' ] ) ;
2036 }
2137 }
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
You can’t perform that action at this time.
0 commit comments