@brimdata/zealot
Version:
The Javascript Client for Zed Lakes
29 lines (22 loc) • 541 B
text/typescript
import {Type} from "../types/types"
import {isNull} from "../utils/is-null"
import {Value} from "./types"
export abstract class Primitive implements Value {
abstract type: Type
abstract toJS(): any
constructor(public value: string | null = null) {}
isUnset() {
return isNull(this.value)
}
isSet() {
return !this.isUnset()
}
toString() {
if (isNull(this.value)) return "null"
return this.value.toString()
}
serialize() {
if (isNull(this.value)) return null
return this.value.toString()
}
}