UNPKG

@codification/cutwater-aws

Version:

A library providing general functionality for TypeScript based AWS projects.

29 lines 1.01 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.CompoundValue = void 0; class CompoundValue { static create(...value) { if (value.length === 0) { return new CompoundValue([]); } if (value.length === 1 && typeof value[0] === 'string') { return new CompoundValue(value[0].split(CompoundValue.VALUE_SEPARATOR)); } return new CompoundValue(value.filter((el) => el !== undefined).map((el) => (typeof el === 'number' ? el.toString() : el))); } constructor(elements) { this.elements = elements; } get parts() { return [...this.elements]; } getPart(index, defaultValue) { return this.elements.length > index ? this.elements[index] : defaultValue; } get value() { return this.elements.join(CompoundValue.VALUE_SEPARATOR); } } exports.CompoundValue = CompoundValue; CompoundValue.VALUE_SEPARATOR = '#'; //# sourceMappingURL=CompoundValue.js.map