Comparing version 1.12.20 to 1.13.0
@@ -93,4 +93,7 @@ "use strict"; | ||
generalFunctions(model) { | ||
// model.addFunction('async sleep(ms?: number)', Functions.sleep) | ||
model.addFunction('console(value:any)', (value) => { | ||
// model.addFunction('sleep(ms?: number):void', (ms: number = 0):void => { | ||
// const promise = new Promise(resolve => setTimeout(resolve, ms)) | ||
// awaiter(() => promise) | ||
// }) | ||
model.addFunction('console(value:any):void', (value) => { | ||
console.log(typeof value === 'object' ? JSON.stringify(value) : value); | ||
@@ -97,0 +100,0 @@ }); |
@@ -139,8 +139,8 @@ "use strict"; | ||
this.index += 1; | ||
if (value.includes('.')) { | ||
if (value.includes('.') && !this.model.isFunction(value)) { | ||
const names = h3lp_1.h3lp.obj.names(value); | ||
const functionName = names.pop(); | ||
const variableName = names.join('.'); | ||
const variable = new domain_1.Operand(pos, variableName, domain_1.OperandType.Var); | ||
operand = this.getChildFunc(functionName, variable); | ||
const childName = names.pop(); | ||
const parentName = names.join('.'); | ||
const variable = new domain_1.Operand(pos, parentName, domain_1.OperandType.Var); | ||
operand = this.getChildFunc(childName, variable); | ||
} | ||
@@ -278,3 +278,3 @@ else { | ||
this.index += 1; | ||
if (name.includes('.')) { | ||
if (name.includes('.') && !this.model.isFunction(name)) { | ||
// .xxx.xxx(p=> p.xxx) | ||
@@ -281,0 +281,0 @@ const names = h3lp_1.h3lp.obj.names(name); |
@@ -16,6 +16,13 @@ "use strict"; | ||
else if (operand.type === domain_1.OperandType.CallFunc) { | ||
// Example: .[0].states.filter() where function name is states.filter | ||
const names = operand.name.split('.'); | ||
const funcName = names[names.length - 1]; | ||
const funcMetadata = this.model.getFunction(funcName); | ||
let funcMetadata = null; | ||
if (this.model.isFunction(operand.name)) { | ||
// Example: orm.execute(expression, data, options) | ||
funcMetadata = this.model.getFunction(operand.name); | ||
} | ||
else { | ||
// Example: .[0].states.filter() where function name is states.filter | ||
const names = operand.name.split('.'); | ||
const funcName = names[names.length - 1]; | ||
funcMetadata = this.model.getFunction(funcName); | ||
} | ||
if (funcMetadata && funcMetadata.deterministic) { | ||
@@ -22,0 +29,0 @@ return this.reduceOperand(operand); |
{ | ||
"name": "3xpr", | ||
"version": "1.12.20", | ||
"version": "1.13.0", | ||
"description": "expressions", | ||
@@ -5,0 +5,0 @@ "author": "Flavio Lionel Rita <flaviolrita@hotmail.com>", |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
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
589225
7155