mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-18 22:10:41 -07:00
fix default filter use isTruthy, working on #30
This commit is contained in:
+2
-1
@@ -1,5 +1,6 @@
|
|||||||
const strftime = require('./src/util/strftime.js');
|
const strftime = require('./src/util/strftime.js');
|
||||||
const _ = require('./src/util/underscore.js');
|
const _ = require('./src/util/underscore.js');
|
||||||
|
const isTruthy = require('./src/syntax.js').isTruthy;
|
||||||
|
|
||||||
var escapeMap = {
|
var escapeMap = {
|
||||||
'&': '&',
|
'&': '&',
|
||||||
@@ -25,7 +26,7 @@ var filters = {
|
|||||||
if (v === 'now') v = new Date();
|
if (v === 'now') v = new Date();
|
||||||
return v instanceof Date ? strftime(v, arg) : '';
|
return v instanceof Date ? strftime(v, arg) : '';
|
||||||
},
|
},
|
||||||
'default': (v, arg) => v || arg,
|
'default': (v, arg) => isTruthy(v) ? v : arg,
|
||||||
'divided_by': (v, arg) => Math.floor(v / arg),
|
'divided_by': (v, arg) => Math.floor(v / arg),
|
||||||
'downcase': v => v.toLowerCase(),
|
'downcase': v => v.toLowerCase(),
|
||||||
'escape': escape,
|
'escape': escape,
|
||||||
|
|||||||
Reference in New Issue
Block a user