UNPKG

@brimdata/zealot

Version:

The Javascript Client for Zed Lakes

47 lines (46 loc) 1.28 kB
/* eslint-disable @typescript-eslint/no-array-constructor */ "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); Object.defineProperty(exports, "TypeArray", { enumerable: true, get: ()=>TypeArray }); const _isNull = require("../utils/is-null"); const _array = require("../values/array"); 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 TypeArray { static stringify(type) { return `[${type.toString()}]`; } create(values, stream) { return new _array.Array(this, (0, _isNull.isNull)(values) ? null : values.map((value)=>this.type.create(value, stream))); } serialize(stream) { return { kind: "array", type: stream.encodeType(this.type) }; } toString() { return "[" + this.type.toString() + "]"; } constructor(type){ _defineProperty(this, "id", void 0); _defineProperty(this, "kind", "array"); _defineProperty(this, "type", void 0); this.type = type; } }