Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function Stringify(options) {
if (!(this instanceof Stringify))
return new Stringify(options || {})
if (options && options.replacer) {
this.replacer = options.replacer;
}
if (options && options.space !== undefined) {
this.space = options.space;
}
Transform.call(this, options || {})
this._writableState.objectMode = true
// Array Deliminator and Stringifier defaults
var opener = options && options.opener ? options.opener : '[\n'
var seperator = options && options.seperator ? options.seperator : '\n,\n'
var closer = options && options.closer ? options.closer : '\n]\n'
var stringifier = options && options.stringifier ? options.stringifier : stringify
// Array Deliminators and Stringifier
this.opener = new Buffer(opener, 'utf8')
this.seperator = new Buffer(seperator, 'utf8')
this.closer = new Buffer(closer, 'utf8')
this.stringifier = stringifier
}
function Parse(opts) {
var self = this;
if (!(this instanceof Parse)) {
return new Parse(opts);
}
Transform.call(this, { lowWaterMark: 0 });
this._opts = opts || { verbose: false };
this._hasEntryListener = false;
this._pullStream = new PullStream();
this._pullStream.on("error", function (e) {
self.emit('error', e);
});
this._pullStream.once("end", function () {
self._streamEnd = true;
});
this._pullStream.once("finish", function () {
self._streamFinish = true;
});
this._readRecord();
}
function ScriptInjectorStream(script, options) {
var self = this;
if(!(self instanceof ScriptInjectorStream)) {
return new ScriptInjectorStream(script, options)
}
Transform.call(self, options)
self._script = script ?
script+'':
'('+function() { console.log("You didn't provide a script to inject.") }+')()'
self.should_inject = true
self.html_parser = new hp.Parser({
onprocessinginstruction: function (name, data) {
self.push('<' + data + '>')
},
onopentag: function (name, attribs) {
var output = ''
if(name === 'script' && self.should_inject) {
self.should_inject = false
output += '
function DestroyableTransform(opts) {
Transform.call(this, opts)
this._destroyed = false
}
function DestroyableTransform(opts) {
Transform.call(this, opts)
this._destroyed = false
}
function Through2 (override) {
if (!(this instanceof Through2))
return new Through2(override)
this.options = xtend(options, override)
Transform.call(this, this.options)
}
function Through2 (override) {
if (!(this instanceof Through2))
return new Through2(override)
this.options = xtend(options, override)
Transform.call(this, this.options)
}
function DestroyableTransform(opts) {
Transform.call(this, opts)
this._destroyed = false
}
function DestroyableTransform(opts) {
Transform.call(this, opts)
this._destroyed = false
}