UNPKG

@ezs/basics

Version:
47 lines (45 loc) 847 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.default = void 0; var _string_decoder = require("string_decoder"); function TXTConcat(data, feed) { if (!this.decoder) { this.decoder = new _string_decoder.StringDecoder('utf8'); } if (this.buffer === undefined) { this.buffer = ''; } if (this.isLast()) { this.decoder.end(); feed.send(this.buffer); feed.close(); } else { this.buffer = this.buffer.concat(Buffer.isBuffer(data) ? this.decoder.write(data) : data); feed.end(); } } /** * Concatenate all `String` items into one string * * Input: * * ```json * ["a", "b"] * ``` * * Output: * * ```json * ["ab"] * ``` * * @name TXTConcat * @alias concat * @param {undefined} none * @returns {String} */ var _default = exports.default = { TXTConcat };