@@ -7,6 +7,9 @@ function BasicEvaluatedExpression() {
77}
88module . exports = BasicEvaluatedExpression ;
99
10+ BasicEvaluatedExpression . prototype . isNull = function ( ) {
11+ return ! ! this . null ;
12+ } ;
1013BasicEvaluatedExpression . prototype . isString = function ( ) {
1114 return Object . prototype . hasOwnProperty . call ( this , "string" ) ;
1215} ;
@@ -36,6 +39,7 @@ BasicEvaluatedExpression.prototype.isWrapped = function() {
3639} ;
3740BasicEvaluatedExpression . prototype . asBool = function ( ) {
3841 if ( this . isBoolean ( ) ) return this . bool ;
42+ else if ( this . isNull ( ) ) return false ;
3943 else if ( this . isString ( ) ) return ! ! this . string ;
4044 else if ( this . isNumber ( ) ) return ! ! this . number ;
4145 else if ( this . isRegExp ( ) ) return true ;
@@ -48,6 +52,7 @@ BasicEvaluatedExpression.prototype.set = function(value) {
4852 if ( typeof value === "string" ) return this . setString ( value ) ;
4953 if ( typeof value === "number" ) return this . setNumber ( value ) ;
5054 if ( typeof value === "boolean" ) return this . setBoolean ( value ) ;
55+ if ( value === null ) return this . setNull ( ) ;
5156 if ( value instanceof RegExp ) return this . setRegExp ( value ) ;
5257 if ( Array . isArray ( value ) ) return this . setArray ( value ) ;
5358 return this ;
@@ -59,6 +64,10 @@ BasicEvaluatedExpression.prototype.setString = function(str) {
5964 this . string = str ;
6065 return this ;
6166} ;
67+ BasicEvaluatedExpression . prototype . setNull = function ( str ) {
68+ this . null = true ;
69+ return this ;
70+ } ;
6271BasicEvaluatedExpression . prototype . setNumber = function ( num ) {
6372 if ( num === null )
6473 delete this . number ;
0 commit comments