mirror of
https://github.com/harttle/liquidjs.git
synced 2026-09-18 14:00:39 -07:00
feat: nil/null/empty/blank literals, resolves #102
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
import { Drop } from './drop'
|
||||
import { IComparable } from './icomparable'
|
||||
import { isObject, isString, isArray } from 'src/util/underscore'
|
||||
import { IDrop } from 'src/drop/idrop'
|
||||
|
||||
export class EmptyDrop extends Drop implements IDrop, IComparable {
|
||||
equals (value: any) {
|
||||
if (isString(value) || isArray(value)) return value.length === 0
|
||||
if (isObject(value)) return Object.keys(value).length === 0
|
||||
return false
|
||||
}
|
||||
gt () {
|
||||
return false
|
||||
}
|
||||
geq () {
|
||||
return false
|
||||
}
|
||||
lt () {
|
||||
return false
|
||||
}
|
||||
leq () {
|
||||
return false
|
||||
}
|
||||
value () {
|
||||
return ''
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user