@brimdata/zealot
Version:
The Javascript Client for Zed Lakes
50 lines (49 loc) • 1.27 kB
JavaScript
;
Object.defineProperty(exports, "__esModule", {
value: true
});
Object.defineProperty(exports, "TypeValue", {
enumerable: true,
get: ()=>TypeValue
});
const _typeType = require("../types/type-type");
const _isNull = require("../utils/is-null");
function _defineProperty(obj, key, value) {
if (key in obj) {
Object.defineProperty(obj, key, {
value: value,
enumerable: true,
configurable: true,
writable: true
});
} else {
obj[key] = value;
}
return obj;
}
class TypeValue {
isUnset() {
return (0, _isNull.isNull)(this.value);
}
toString() {
if ((0, _isNull.isNull)(this.value)) return "null";
return this.value.toString();
}
serialize(stream) {
if ((0, _isNull.isNull)(this.value)) {
return null;
} else {
return this.value.serialize(stream);
}
}
toJS() {
if ((0, _isNull.isNull)(this.value)) return null;
return this.toString();
}
constructor(value = null){
_defineProperty(this, "value", void 0);
_defineProperty(this, "type", void 0);
this.value = value;
this.type = _typeType.TypeType;
}
}