mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-16 12:50:38 -07:00
fix: pass drops directly to filters/tags
This commit is contained in:
@@ -1,11 +1,10 @@
|
||||
import { isNil, isString } from '../util/underscore'
|
||||
import { Drop } from '../drop/drop'
|
||||
import { isNil, isString, toValue } from '../util/underscore'
|
||||
import { EmptyDrop } from '../drop/empty-drop'
|
||||
|
||||
export class BlankDrop extends EmptyDrop {
|
||||
equals (value: any) {
|
||||
if (value === false) return true
|
||||
if (isNil(value instanceof Drop ? value.valueOf() : value)) return true
|
||||
if (isNil(toValue(value))) return true
|
||||
if (isString(value)) return /^\s*$/.test(value)
|
||||
return super.equals(value)
|
||||
}
|
||||
|
||||
@@ -1,11 +1,11 @@
|
||||
import { Drop } from './drop'
|
||||
import { IComparable } from './icomparable'
|
||||
import { isNil } from '../util/underscore'
|
||||
import { isNil, toValue } from '../util/underscore'
|
||||
import { BlankDrop } from '../drop/blank-drop'
|
||||
|
||||
export class NullDrop extends Drop implements IComparable {
|
||||
equals (value: any) {
|
||||
return isNil(value instanceof Drop ? value.valueOf() : value) || value instanceof BlankDrop
|
||||
return isNil(toValue(value)) || value instanceof BlankDrop
|
||||
}
|
||||
gt () {
|
||||
return false
|
||||
|
||||
Reference in New Issue
Block a user