mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-20 06:50:47 -07:00
fixes #91
This commit is contained in:
@@ -1,5 +1,4 @@
|
|||||||
// const Liquid = require('../..')
|
const Liquid = require('../..')
|
||||||
const Liquid = require('../../dist/liquid.common.js')
|
|
||||||
|
|
||||||
const engine = new Liquid({
|
const engine = new Liquid({
|
||||||
root: __dirname,
|
root: __dirname,
|
||||||
|
|||||||
@@ -19,8 +19,8 @@ export function stringify (value) {
|
|||||||
if (typeof value.toLiquid === 'function') {
|
if (typeof value.toLiquid === 'function') {
|
||||||
return stringify(value.toLiquid())
|
return stringify(value.toLiquid())
|
||||||
}
|
}
|
||||||
if (isString(value)) {
|
if (isString(value) || value instanceof RegExp || value instanceof Date) {
|
||||||
return value
|
return value.toString()
|
||||||
}
|
}
|
||||||
|
|
||||||
const cache = []
|
const cache = []
|
||||||
|
|||||||
@@ -51,6 +51,11 @@ describe('util/underscore', function () {
|
|||||||
it('should return "undefined" for undefined', function () {
|
it('should return "undefined" for undefined', function () {
|
||||||
expect(_.stringify(undefined)).to.equal('undefined')
|
expect(_.stringify(undefined)).to.equal('undefined')
|
||||||
})
|
})
|
||||||
|
it('should return locale string for date', function () {
|
||||||
|
const date = new Date('2018-10-01T14:51:00.000Z')
|
||||||
|
// Mon Oct 01 2018 22:51:00 GMT+0800 (CST)
|
||||||
|
expect(_.stringify(date)).to.equal(date.toString())
|
||||||
|
})
|
||||||
})
|
})
|
||||||
describe('.forOwn()', function () {
|
describe('.forOwn()', function () {
|
||||||
it('should iterate all properties', function () {
|
it('should iterate all properties', function () {
|
||||||
|
|||||||
Reference in New Issue
Block a user