mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 21:00:40 -07:00
feat: JSON format by space in json filter
This commit is contained in:
+2
-2
@@ -9,8 +9,8 @@ export function Default<T1 extends boolean, T2> (this: FilterImpl, value: T1, de
|
||||
return isFalsy(value, this.context) ? defaultValue : value
|
||||
}
|
||||
|
||||
export function json (value: any) {
|
||||
return JSON.stringify(value)
|
||||
export function json (value: any, space = 0) {
|
||||
return JSON.stringify(value, null, space)
|
||||
}
|
||||
|
||||
export const raw = {
|
||||
|
||||
@@ -26,7 +26,7 @@ describe('TimezoneDate', () => {
|
||||
})
|
||||
it('should support .toLocaleTimeString()', () => {
|
||||
const date = new TimezoneDate('2021-10-06T00:00:00.001+00:00', -480)
|
||||
expect(date.toLocaleTimeString('en-US')).toBe('8:00:00 AM')
|
||||
expect(date.toLocaleTimeString('en-US')).toMatch(/^8:00:00\sAM$/)
|
||||
expect(() => date.toLocaleDateString()).not.toThrow()
|
||||
})
|
||||
it('should support .toLocaleDateString()', () => {
|
||||
|
||||
Reference in New Issue
Block a user