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

Function validChunk

static/word2md/mammoth.browser.js:25517–25532  ·  view source on GitHub ↗
(stream, state, chunk, cb)

Source from the content-addressed store, hash-verified

25515// mode the stream is in. Currently this means that `null` is never accepted
25516// and undefined/non-string values are only allowed in object mode.
25517function validChunk(stream, state, chunk, cb) {
25518 var valid = true;
25519 var er = false;
25520
25521 if (chunk === null) {
25522 er = new TypeError('May not write null values to stream');
25523 } else if (typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
25524 er = new TypeError('Invalid non-string/buffer chunk');
25525 }
25526 if (er) {
25527 stream.emit('error', er);
25528 processNextTick(cb, er);
25529 valid = false;
25530 }
25531 return valid;
25532}
25533
25534Writable.prototype.write = function (chunk, encoding, cb) {
25535 var state = this._writableState;

Callers 1

mammoth.browser.jsFile · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected