mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-19 06:20:38 -07:00
2.1.0
This commit is contained in:
Vendored
+12
-3
@@ -37,8 +37,13 @@ var filters = {
|
|||||||
return Array.prototype.concat.call(v, arg);
|
return Array.prototype.concat.call(v, arg);
|
||||||
},
|
},
|
||||||
'date': function date(v, arg) {
|
'date': function date(v, arg) {
|
||||||
if (v === 'now') v = new Date();
|
var date = v;
|
||||||
return v instanceof Date ? strftime(v, arg) : '';
|
if (v === 'now') {
|
||||||
|
date = new Date();
|
||||||
|
} else if (_.isString(v)) {
|
||||||
|
date = new Date(v);
|
||||||
|
}
|
||||||
|
return isValidDate(date) ? strftime(date, arg) : v;
|
||||||
},
|
},
|
||||||
'default': function _default(v, arg) {
|
'default': function _default(v, arg) {
|
||||||
return isTruthy(v) ? v : arg;
|
return isTruthy(v) ? v : arg;
|
||||||
@@ -203,6 +208,10 @@ function registerAll(liquid) {
|
|||||||
});
|
});
|
||||||
}
|
}
|
||||||
|
|
||||||
|
function isValidDate(date) {
|
||||||
|
return date instanceof Date && !isNaN(date.getTime());
|
||||||
|
}
|
||||||
|
|
||||||
registerAll.filters = filters;
|
registerAll.filters = filters;
|
||||||
module.exports = registerAll;
|
module.exports = registerAll;
|
||||||
|
|
||||||
@@ -921,7 +930,7 @@ var Scope = {
|
|||||||
},
|
},
|
||||||
get: function get(str) {
|
get: function get(str) {
|
||||||
if (str === 'liquid') {
|
if (str === 'liquid') {
|
||||||
throw new Error('NO LONGER SUPPORTED: use scope.opts instread of scope.get("liquid")');
|
throw new Error('NO LONGER SUPPORTED: use scope.opts instead of scope.get("liquid")');
|
||||||
}
|
}
|
||||||
try {
|
try {
|
||||||
return this.getPropertyByPath(this.scopes, str);
|
return this.getPropertyByPath(this.scopes, str);
|
||||||
|
|||||||
Vendored
+1
-1
File diff suppressed because one or more lines are too long
+1
-1
@@ -1,6 +1,6 @@
|
|||||||
{
|
{
|
||||||
"name": "liquidjs",
|
"name": "liquidjs",
|
||||||
"version": "2.0.3",
|
"version": "2.1.0",
|
||||||
"description": "A Liquid template engine for Node.js and browsers, with all shopify/liquid features.",
|
"description": "A Liquid template engine for Node.js and browsers, with all shopify/liquid features.",
|
||||||
"main": "index.js",
|
"main": "index.js",
|
||||||
"scripts": {
|
"scripts": {
|
||||||
|
|||||||
Reference in New Issue
Block a user