ts-expression-evaluator
Advanced tools
Comparing version 1.3.8 to 1.3.9
import * as t from './t'; | ||
export declare type HandlerTypes = 'BinaryExpression' | 'NumericLiteral' | 'StringLiteral' | 'BooleanLiteral' | 'ArrayExpression' | 'NullLiteral' | 'Identifier' | 'CallExpression' | 'MemberExpression' | 'LogicalExpression' | 'UnaryExpression' | 'ThisExpression'; | ||
export declare type HandlerTypes = 'BinaryExpression' | 'NumericLiteral' | 'StringLiteral' | 'BooleanLiteral' | 'ArrayExpression' | 'NullLiteral' | 'Identifier' | 'CallExpression' | 'MemberExpression' | 'LogicalExpression' | 'UnaryExpression' | 'ThisExpression' | 'ConditionalExpression'; | ||
export declare type Context = { | ||
@@ -4,0 +4,0 @@ [key: string]: any; |
@@ -45,2 +45,8 @@ "use strict"; | ||
}, | ||
ConditionalExpression: function (ast, context) { | ||
if (t.isConditionalExpression(ast)) { | ||
return Evaluator_1.evaluate(ast.test, context) ? Evaluator_1.evaluate(ast.consequent, context) : Evaluator_1.evaluate(ast.alternate, context); | ||
} | ||
throw new Error(); | ||
}, | ||
LogicalExpression: function (ast, context) { | ||
@@ -47,0 +53,0 @@ if (t.isLogicalExpression(ast)) { |
@@ -14,2 +14,3 @@ import * as t from '@babel/types'; | ||
export declare const isThisExpression: (ast: t.Expression) => ast is t.ThisExpression; | ||
export declare const isConditionalExpression: (ast: t.Expression) => ast is t.ConditionalExpression; | ||
export declare type Expression = t.Expression; |
@@ -39,1 +39,4 @@ "use strict"; | ||
}; | ||
exports.isConditionalExpression = function (ast) { | ||
return ast.type === 'ConditionalExpression'; | ||
}; |
import * as t from './t'; | ||
export declare type HandlerTypes = 'BinaryExpression' | 'NumericLiteral' | 'StringLiteral' | 'BooleanLiteral' | 'ArrayExpression' | 'NullLiteral' | 'Identifier' | 'CallExpression' | 'MemberExpression' | 'LogicalExpression' | 'UnaryExpression' | 'ThisExpression'; | ||
export declare type HandlerTypes = 'BinaryExpression' | 'NumericLiteral' | 'StringLiteral' | 'BooleanLiteral' | 'ArrayExpression' | 'NullLiteral' | 'Identifier' | 'CallExpression' | 'MemberExpression' | 'LogicalExpression' | 'UnaryExpression' | 'ThisExpression' | 'ConditionalExpression'; | ||
export declare type Context = { | ||
@@ -4,0 +4,0 @@ [key: string]: any; |
@@ -36,2 +36,8 @@ import * as t from './t'; | ||
}, | ||
ConditionalExpression: function (ast, context) { | ||
if (t.isConditionalExpression(ast)) { | ||
return evaluate(ast.test, context) ? evaluate(ast.consequent, context) : evaluate(ast.alternate, context); | ||
} | ||
throw new Error(); | ||
}, | ||
LogicalExpression: function (ast, context) { | ||
@@ -38,0 +44,0 @@ if (t.isLogicalExpression(ast)) { |
@@ -14,2 +14,3 @@ import * as t from '@babel/types'; | ||
export declare const isThisExpression: (ast: t.Expression) => ast is t.ThisExpression; | ||
export declare const isConditionalExpression: (ast: t.Expression) => ast is t.ConditionalExpression; | ||
export declare type Expression = t.Expression; |
@@ -37,1 +37,4 @@ export var isIdentifier = function (ast) { | ||
}; | ||
export var isConditionalExpression = function (ast) { | ||
return ast.type === 'ConditionalExpression'; | ||
}; |
{ | ||
"name": "ts-expression-evaluator", | ||
"version": "1.3.8", | ||
"version": "1.3.9", | ||
"description": "Context-based expression parse and evaluator.", | ||
@@ -5,0 +5,0 @@ "main": "build/main/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
194012
540