Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

velocityjs

Package Overview
Dependencies
Maintainers
1
Versions
78
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

velocityjs - npm Package Compare versions

Comparing version 2.0.1 to 2.0.2

test/compile.test.js

4

History.md

@@ -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 @@

2

package.json
{
"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]);

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc