feat: nil/null/empty/blank literals, resolves #102

This commit is contained in:
harttle
2019-02-24 21:50:01 +08:00
parent 54b2adce12
commit 88c9e96392
19 changed files with 355 additions and 52 deletions
+27
View File
@@ -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 ''
}
}