UNPKG

ngx-i18nsupport

Version:

Some tooling to be used with the Angular 2 i18n workflow

52 lines 1.97 kB
"use strict"; var __extends = (this && this.__extends) || (function () { var extendStatics = Object.setPrototypeOf || ({ __proto__: [] } instanceof Array && function (d, b) { d.__proto__ = b; }) || function (d, b) { for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]; }; return function (d, b) { extendStatics(d, b); function __() { this.constructor = d; } d.prototype = b === null ? Object.create(b) : (__.prototype = b.prototype, new __()); }; })(); Object.defineProperty(exports, "__esModule", { value: true }); var stream_1 = require("stream"); var util_1 = require("util"); /** * Created by martin on 20.02.2017. * A helper class for testing. * Can be used as a WritableStream and writes everything (synchronously) into a string, * that can easily be read by the tests. */ var WriterToString = /** @class */ (function (_super) { __extends(WriterToString, _super); function WriterToString() { var _this = _super.call(this) || this; _this.resultString = ''; return _this; } WriterToString.prototype._write = function (chunk, encoding, callback) { var chunkString; if (util_1.isString(chunk)) { chunkString = chunk; } else if (chunk instanceof Buffer) { chunkString = chunk.toString(); } else { chunkString = new Buffer(chunk).toString(encoding); } this.resultString = this.resultString + chunkString; callback(); }; /** * Returns a string of everything, that was written to the stream so far. * @return {string} */ WriterToString.prototype.writtenData = function () { return this.resultString; }; return WriterToString; }(stream_1.Writable)); exports.WriterToString = WriterToString; //# sourceMappingURL=S:/experimente/ngx-i18nsupport/common/writer-to-string.js.map