velocityjs
Advanced tools
Comparing version 2.0.1 to 2.0.2
@@ -0,1 +1,5 @@ | ||
## 2.0.2 2020-10-19 | ||
- add default set and get method for array and map object [133](https://github.com/shepherdwind/velocity.js/pull/133) | ||
## 2.0.1 2020-09-02 | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "velocityjs", | ||
"description": "Velocity Template Language(VTL) for JavaScript", | ||
"version": "2.0.1", | ||
"version": "2.0.2", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "keywords": [ |
@@ -221,16 +221,19 @@ module.exports = function(Velocity, utils) { | ||
// getter 处理 | ||
// get(xxx) | ||
if (id === 'get' && !(id in baseRef)) { | ||
return getter(baseRef, this.getLiteral(property.args[0])); | ||
} | ||
if (id === 'set' && !(id in baseRef)) { | ||
baseRef[this.getLiteral(property.args[0])] = this.getLiteral(property.args[1]); | ||
return ''; | ||
} | ||
// getter for example: getAddress() | ||
if (id.indexOf('get') === 0 && !(id in baseRef)) { | ||
if (id.length === 3) { | ||
// get('address') | ||
ret = getter(baseRef, this.getLiteral(property.args[0])); | ||
} else { | ||
// getAddress() | ||
ret = getter(baseRef, id.slice(3)); | ||
} | ||
return getter(baseRef, id.slice(3)); | ||
} | ||
return ret; | ||
// setter 处理 | ||
} else if (id.indexOf('set') === 0 && !baseRef[id]) { | ||
if (id.indexOf('set') === 0 && !baseRef[id]) { | ||
@@ -237,0 +240,0 @@ baseRef[id.slice(3)] = this.getLiteral(property.args[0]); |
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
176766
43
3725