Every new change
This commit is contained in:
15
node_modules/mute-stream/LICENSE
generated
vendored
Normal file
15
node_modules/mute-stream/LICENSE
generated
vendored
Normal file
@ -0,0 +1,15 @@
|
||||
The ISC License
|
||||
|
||||
Copyright (c) Isaac Z. Schlueter and Contributors
|
||||
|
||||
Permission to use, copy, modify, and/or distribute this software for any
|
||||
purpose with or without fee is hereby granted, provided that the above
|
||||
copyright notice and this permission notice appear in all copies.
|
||||
|
||||
THE SOFTWARE IS PROVIDED "AS IS" AND THE AUTHOR DISCLAIMS ALL WARRANTIES
|
||||
WITH REGARD TO THIS SOFTWARE INCLUDING ALL IMPLIED WARRANTIES OF
|
||||
MERCHANTABILITY AND FITNESS. IN NO EVENT SHALL THE AUTHOR BE LIABLE FOR
|
||||
ANY SPECIAL, DIRECT, INDIRECT, OR CONSEQUENTIAL DAMAGES OR ANY DAMAGES
|
||||
WHATSOEVER RESULTING FROM LOSS OF USE, DATA OR PROFITS, WHETHER IN AN
|
||||
ACTION OF CONTRACT, NEGLIGENCE OR OTHER TORTIOUS ACTION, ARISING OUT OF OR
|
||||
IN CONNECTION WITH THE USE OR PERFORMANCE OF THIS SOFTWARE.
|
68
node_modules/mute-stream/README.md
generated
vendored
Normal file
68
node_modules/mute-stream/README.md
generated
vendored
Normal file
@ -0,0 +1,68 @@
|
||||
# mute-stream
|
||||
|
||||
Bytes go in, but they don't come out (when muted).
|
||||
|
||||
This is a basic pass-through stream, but when muted, the bytes are
|
||||
silently dropped, rather than being passed through.
|
||||
|
||||
## Usage
|
||||
|
||||
```javascript
|
||||
var MuteStream = require('mute-stream')
|
||||
|
||||
var ms = new MuteStream(options)
|
||||
|
||||
ms.pipe(process.stdout)
|
||||
ms.write('foo') // writes 'foo' to stdout
|
||||
ms.mute()
|
||||
ms.write('bar') // does not write 'bar'
|
||||
ms.unmute()
|
||||
ms.write('baz') // writes 'baz' to stdout
|
||||
|
||||
// can also be used to mute incoming data
|
||||
var ms = new MuteStream
|
||||
input.pipe(ms)
|
||||
|
||||
ms.on('data', function (c) {
|
||||
console.log('data: ' + c)
|
||||
})
|
||||
|
||||
input.emit('data', 'foo') // logs 'foo'
|
||||
ms.mute()
|
||||
input.emit('data', 'bar') // does not log 'bar'
|
||||
ms.unmute()
|
||||
input.emit('data', 'baz') // logs 'baz'
|
||||
```
|
||||
|
||||
## Options
|
||||
|
||||
All options are optional.
|
||||
|
||||
* `replace` Set to a string to replace each character with the
|
||||
specified string when muted. (So you can show `****` instead of the
|
||||
password, for example.)
|
||||
|
||||
* `prompt` If you are using a replacement char, and also using a
|
||||
prompt with a readline stream (as for a `Password: *****` input),
|
||||
then specify what the prompt is so that backspace will work
|
||||
properly. Otherwise, pressing backspace will overwrite the prompt
|
||||
with the replacement character, which is weird.
|
||||
|
||||
## ms.mute()
|
||||
|
||||
Set `muted` to `true`. Turns `.write()` into a no-op.
|
||||
|
||||
## ms.unmute()
|
||||
|
||||
Set `muted` to `false`
|
||||
|
||||
## ms.isTTY
|
||||
|
||||
True if the pipe destination is a TTY, or if the incoming pipe source is
|
||||
a TTY.
|
||||
|
||||
## Other stream methods...
|
||||
|
||||
The other standard readable and writable stream methods are all
|
||||
available. The MuteStream object acts as a facade to its pipe source
|
||||
and destination.
|
145
node_modules/mute-stream/mute.js
generated
vendored
Normal file
145
node_modules/mute-stream/mute.js
generated
vendored
Normal file
@ -0,0 +1,145 @@
|
||||
var Stream = require('stream')
|
||||
|
||||
module.exports = MuteStream
|
||||
|
||||
// var out = new MuteStream(process.stdout)
|
||||
// argument auto-pipes
|
||||
function MuteStream (opts) {
|
||||
Stream.apply(this)
|
||||
opts = opts || {}
|
||||
this.writable = this.readable = true
|
||||
this.muted = false
|
||||
this.on('pipe', this._onpipe)
|
||||
this.replace = opts.replace
|
||||
|
||||
// For readline-type situations
|
||||
// This much at the start of a line being redrawn after a ctrl char
|
||||
// is seen (such as backspace) won't be redrawn as the replacement
|
||||
this._prompt = opts.prompt || null
|
||||
this._hadControl = false
|
||||
}
|
||||
|
||||
MuteStream.prototype = Object.create(Stream.prototype)
|
||||
|
||||
Object.defineProperty(MuteStream.prototype, 'constructor', {
|
||||
value: MuteStream,
|
||||
enumerable: false
|
||||
})
|
||||
|
||||
MuteStream.prototype.mute = function () {
|
||||
this.muted = true
|
||||
}
|
||||
|
||||
MuteStream.prototype.unmute = function () {
|
||||
this.muted = false
|
||||
}
|
||||
|
||||
Object.defineProperty(MuteStream.prototype, '_onpipe', {
|
||||
value: onPipe,
|
||||
enumerable: false,
|
||||
writable: true,
|
||||
configurable: true
|
||||
})
|
||||
|
||||
function onPipe (src) {
|
||||
this._src = src
|
||||
}
|
||||
|
||||
Object.defineProperty(MuteStream.prototype, 'isTTY', {
|
||||
get: getIsTTY,
|
||||
set: setIsTTY,
|
||||
enumerable: true,
|
||||
configurable: true
|
||||
})
|
||||
|
||||
function getIsTTY () {
|
||||
return( (this._dest) ? this._dest.isTTY
|
||||
: (this._src) ? this._src.isTTY
|
||||
: false
|
||||
)
|
||||
}
|
||||
|
||||
// basically just get replace the getter/setter with a regular value
|
||||
function setIsTTY (isTTY) {
|
||||
Object.defineProperty(this, 'isTTY', {
|
||||
value: isTTY,
|
||||
enumerable: true,
|
||||
writable: true,
|
||||
configurable: true
|
||||
})
|
||||
}
|
||||
|
||||
Object.defineProperty(MuteStream.prototype, 'rows', {
|
||||
get: function () {
|
||||
return( this._dest ? this._dest.rows
|
||||
: this._src ? this._src.rows
|
||||
: undefined )
|
||||
}, enumerable: true, configurable: true })
|
||||
|
||||
Object.defineProperty(MuteStream.prototype, 'columns', {
|
||||
get: function () {
|
||||
return( this._dest ? this._dest.columns
|
||||
: this._src ? this._src.columns
|
||||
: undefined )
|
||||
}, enumerable: true, configurable: true })
|
||||
|
||||
|
||||
MuteStream.prototype.pipe = function (dest, options) {
|
||||
this._dest = dest
|
||||
return Stream.prototype.pipe.call(this, dest, options)
|
||||
}
|
||||
|
||||
MuteStream.prototype.pause = function () {
|
||||
if (this._src) return this._src.pause()
|
||||
}
|
||||
|
||||
MuteStream.prototype.resume = function () {
|
||||
if (this._src) return this._src.resume()
|
||||
}
|
||||
|
||||
MuteStream.prototype.write = function (c) {
|
||||
if (this.muted) {
|
||||
if (!this.replace) return true
|
||||
if (c.match(/^\u001b/)) {
|
||||
if(c.indexOf(this._prompt) === 0) {
|
||||
c = c.substr(this._prompt.length);
|
||||
c = c.replace(/./g, this.replace);
|
||||
c = this._prompt + c;
|
||||
}
|
||||
this._hadControl = true
|
||||
return this.emit('data', c)
|
||||
} else {
|
||||
if (this._prompt && this._hadControl &&
|
||||
c.indexOf(this._prompt) === 0) {
|
||||
this._hadControl = false
|
||||
this.emit('data', this._prompt)
|
||||
c = c.substr(this._prompt.length)
|
||||
}
|
||||
c = c.toString().replace(/./g, this.replace)
|
||||
}
|
||||
}
|
||||
this.emit('data', c)
|
||||
}
|
||||
|
||||
MuteStream.prototype.end = function (c) {
|
||||
if (this.muted) {
|
||||
if (c && this.replace) {
|
||||
c = c.toString().replace(/./g, this.replace)
|
||||
} else {
|
||||
c = null
|
||||
}
|
||||
}
|
||||
if (c) this.emit('data', c)
|
||||
this.emit('end')
|
||||
}
|
||||
|
||||
function proxy (fn) { return function () {
|
||||
var d = this._dest
|
||||
var s = this._src
|
||||
if (d && d[fn]) d[fn].apply(d, arguments)
|
||||
if (s && s[fn]) s[fn].apply(s, arguments)
|
||||
}}
|
||||
|
||||
MuteStream.prototype.destroy = proxy('destroy')
|
||||
MuteStream.prototype.destroySoon = proxy('destroySoon')
|
||||
MuteStream.prototype.close = proxy('close')
|
62
node_modules/mute-stream/package.json
generated
vendored
Normal file
62
node_modules/mute-stream/package.json
generated
vendored
Normal file
@ -0,0 +1,62 @@
|
||||
{
|
||||
"_from": "mute-stream@0.0.8",
|
||||
"_id": "mute-stream@0.0.8",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-nnbWWOkoWyUsTjKrhgD0dcz22mdkSnpYqbEjIm2nhwhuxlSkpywJmBo8h0ZqJdkp73mb90SssHkN4rsRaBAfAA==",
|
||||
"_location": "/mute-stream",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "mute-stream@0.0.8",
|
||||
"name": "mute-stream",
|
||||
"escapedName": "mute-stream",
|
||||
"rawSpec": "0.0.8",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.0.8"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/inquirer"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/mute-stream/-/mute-stream-0.0.8.tgz",
|
||||
"_shasum": "1630c42b2251ff81e2a283de96a5497ea92e5e0d",
|
||||
"_spec": "mute-stream@0.0.8",
|
||||
"_where": "/Users/Luca_Schwan/Desktop/DSABot/node_modules/inquirer",
|
||||
"author": {
|
||||
"name": "Isaac Z. Schlueter",
|
||||
"email": "i@izs.me",
|
||||
"url": "http://blog.izs.me/"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/isaacs/mute-stream/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"deprecated": false,
|
||||
"description": "Bytes go in, but they don't come out (when muted).",
|
||||
"devDependencies": {
|
||||
"tap": "^12.1.1"
|
||||
},
|
||||
"directories": {
|
||||
"test": "test"
|
||||
},
|
||||
"files": [
|
||||
"mute.js"
|
||||
],
|
||||
"homepage": "https://github.com/isaacs/mute-stream#readme",
|
||||
"keywords": [
|
||||
"mute",
|
||||
"stream",
|
||||
"pipe"
|
||||
],
|
||||
"license": "ISC",
|
||||
"main": "mute.js",
|
||||
"name": "mute-stream",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git://github.com/isaacs/mute-stream.git"
|
||||
},
|
||||
"scripts": {
|
||||
"test": "tap test/*.js --cov"
|
||||
},
|
||||
"version": "0.0.8"
|
||||
}
|
Reference in New Issue
Block a user