MCPcopy Create free account
hub / github.com/TruthHun/BookStack / Transform

Function Transform

static/word2md/mammoth.browser.js:25185–25214  ·  view source on GitHub ↗
(options)

Source from the content-addressed store, hash-verified

25183}
25184
25185function Transform(options) {
25186 if (!(this instanceof Transform)) return new Transform(options);
25187
25188 Duplex.call(this, options);
25189
25190 this._transformState = new TransformState(this);
25191
25192 var stream = this;
25193
25194 // start out asking for a readable event once data is transformed.
25195 this._readableState.needReadable = true;
25196
25197 // we have implemented the _read method, and done the other things
25198 // that Readable wants before the first _read call, so unset the
25199 // sync guard flag.
25200 this._readableState.sync = false;
25201
25202 if (options) {
25203 if (typeof options.transform === 'function') this._transform = options.transform;
25204
25205 if (typeof options.flush === 'function') this._flush = options.flush;
25206 }
25207
25208 // When the writable side finishes, then flush out anything remaining.
25209 this.once('prefinish', function () {
25210 if (typeof this._flush === 'function') this._flush(function (er, data) {
25211 done(stream, er, data);
25212 });else done(stream);
25213 });
25214}
25215
25216Transform.prototype.push = function (chunk, encoding) {
25217 this._transformState.needTransform = false;

Callers

nothing calls this directly

Calls 1

doneFunction · 0.70

Tested by

no test coverage detected