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
+12
View File
@@ -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)
}
}