mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-20 06:50:47 -07:00
feat: nil/null/empty/blank literals, resolves #102
This commit is contained in:
@@ -0,0 +1,12 @@
|
||||
import { isNil, isString } from 'src/util/underscore'
|
||||
import { isDrop } from 'src/drop/idrop'
|
||||
import { EmptyDrop } from 'src/drop/empty-drop'
|
||||
|
||||
export class BlankDrop extends EmptyDrop {
|
||||
equals (value: any) {
|
||||
if (value === false) return true
|
||||
if (isNil(isDrop(value) ? value.value() : value)) return true
|
||||
if (isString(value)) return /^\s*$/.test(value)
|
||||
return super.equals(value)
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user