@hapi/formula
Advanced tools
Comparing version 1.1.0 to 1.2.0
@@ -318,3 +318,3 @@ 'use strict'; | ||
return method(...innerValues); | ||
return method.call(context, ...innerValues); | ||
}; | ||
@@ -321,0 +321,0 @@ } |
{ | ||
"name": "@hapi/formula", | ||
"description": "Math and string formula parser.", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"repository": "git://github.com/hapijs/formula", | ||
@@ -15,4 +15,4 @@ "main": "lib/index.js", | ||
"devDependencies": { | ||
"@hapi/code": "5.x.x", | ||
"@hapi/lab": "18.x.x" | ||
"@hapi/code": "6.x.x", | ||
"@hapi/lab": "20.x.x" | ||
}, | ||
@@ -19,0 +19,0 @@ "scripts": { |
@@ -118,2 +118,15 @@ 'use strict'; | ||
it('passes context as this to functions', () => { | ||
const functions = { | ||
x: function () { | ||
return this.X; | ||
} | ||
}; | ||
const formula = new Formula('x()', { functions }); | ||
expect(formula.evaluate({ X: 1 })).to.equal(1); | ||
}); | ||
it('parses parenthesis', () => { | ||
@@ -120,0 +133,0 @@ |
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
43988
834