velocityjs
Advanced tools
Comparing version 0.7.3 to 0.7.5-beta
@@ -0,1 +1,5 @@ | ||
## 0.7.4 | ||
- toString like org.apache.velocity when render [56](https://github.com/shepherdwind/velocity.js/issues/56) | ||
## 0.7.3 | ||
@@ -2,0 +6,0 @@ |
{ | ||
"name": "velocityjs", | ||
"description": "Velocity Template Language(VTL) for JavaScript", | ||
"version": "0.7.3", | ||
"version": "0.7.5-beta", | ||
"keywords": [ | ||
@@ -34,3 +34,4 @@ "velocity template" | ||
"buildArgs": "--skip fs,path" | ||
} | ||
}, | ||
"registry": "https://registry.npmjs.org" | ||
} |
Velocity - Template Engine | ||
========================== | ||
[![Build Status](https://secure.travis-ci.org/shepherdwind/velocity.js.png)](https://travis-ci.org/shepherdwind/velocity.js) | ||
[![Build Status](https://travis-ci.org/shepherdwind/velocity.js.svg?branch=master)](https://travis-ci.org/shepherdwind/velocity.js) | ||
[![Coverage Status](https://img.shields.io/coveralls/shepherdwind/velocity.js/master.svg?style=flat)](https://coveralls.io/r/shepherdwind/velocity.js) | ||
@@ -5,0 +5,0 @@ |
@@ -80,3 +80,3 @@ module.exports = function(Velocity, utils) { | ||
case 'references': | ||
str += this.getReferences(ast, true); | ||
str += this.format(this.getReferences(ast, true)); | ||
break; | ||
@@ -110,4 +110,20 @@ | ||
return str; | ||
}, | ||
format: function(value) { | ||
if (utils.isArray(value)) { | ||
return "[" + value.map(this.format.bind(this)).join(", ") + "]"; | ||
} | ||
if (utils.isObject(value)) { | ||
if (value.toString.toString().indexOf('[native code]') === -1) { | ||
return value; | ||
} | ||
var kvJoin = function(k) { return k + "=" + this.format(value[k]); }.bind(this); | ||
return "{" + Object.keys(value).map(kvJoin).join(", ") + "}"; | ||
} | ||
return value; | ||
} | ||
}); | ||
}; |
Sorry, the diff of this file is not supported yet
5
394181
43
2600