Skip to content

armgit / mocha

Public Imported from GitHub
0

☕️ Classic, reliable, trusted test framework for Node.js and the browser

build dist for v3.1.0

Christopher Hiller037cdae4ec7e
diff --git a/mocha.js b/mocha.js
index 3ca0ae9e..1d5b072a 100644
--- a/mocha.js
+++ b/mocha.js
@@ -912,6 +912,8 @@ module.exports = function(suites, context, mocha) {
if (typeof opts.fn === 'function') {
opts.fn.call(suite);
suites.shift();
+ } else if (typeof opts.fn === 'undefined' && !suite.pending) {
+ throw new Error('Suite "' + suite.fullTitle() + '" was defined but no callback was supplied. Supply a callback or explicitly skip the suite.');
}
return suite;
@@ -1076,7 +1078,8 @@ module.exports = function(suite) {
}
return common.suite.create({
title: title,
- file: file
+ file: file,
+ fn: false
});
};
@@ -1090,7 +1093,8 @@ module.exports = function(suite) {
}
return common.suite.only({
title: title,
- file: file
+ file: file,
+ fn: false
});
};
@@ -4168,7 +4172,7 @@ Runnable.prototype.enableTimeouts = function(enabled) {
* @api public
*/
Runnable.prototype.skip = function() {
- throw new Pending();
+ throw new Pending('sync skip');
};
/**
@@ -4333,14 +4337,19 @@ Runnable.prototype.run = function(fn) {
if (this.async) {
this.resetTimeout();
+ // allows skip() to be used in an explicit async context
+ this.skip = function asyncSkip() {
+ done(new Pending('async skip call'));
+ // halt execution. the Runnable will be marked pending
+ // by the previous call, and the uncaught handler will ignore
+ // the failure.
+ throw new Pending('async skip; aborting execution');
+ };
+
if (this.allowUncaught) {
return callFnAsync(this.fn);
}
try {
- // allows skip() to be used in an explicit async context
- this.skip = function() {
- done(new Pending());
- };
callFnAsync(this.fn);
} catch (err) {
done(utils.getError(err));
@@ -4634,6 +4643,10 @@ Runner.prototype.checkGlobals = function(test) {
* @param {Error} err
*/
Runner.prototype.fail = function(test, err) {
+ if (test.isPending()) {
+ return;
+ }
+
++this.failures;
test.state = 'failed';
@@ -4720,9 +4733,11 @@ Runner.prototype.hook = function(name, fn) {
if (name === 'beforeEach' || name === 'afterEach') {
self.test.pending = true;
} else {
- suite.tests.forEach(function(test) {
+ utils.forEach(suite.tests, function(test) {
test.pending = true;
});
+ // a pending hook won't be executed twice.
+ hook.pending = true;
}
} else {
self.failHook(hook, err);
@@ -4828,6 +4843,9 @@ Runner.prototype.runTest = function(fn) {
var self = this;
var test = this.test;
+ if (!test) {
+ return;
+ }
if (this.asyncOnly) {
test.asyncOnly = true;
}
@@ -5109,8 +5127,8 @@ Runner.prototype.uncaught = function(err) {
runnable.clearTimeout();
- // Ignore errors if complete
- if (runnable.state) {
+ // Ignore errors if complete or pending
+ if (runnable.state || runnable.isPending()) {
return;
}
this.fail(runnable, err);
@@ -5268,7 +5286,7 @@ function filterOnly(suite) {
} else {
// Otherwise, do not run any of the tests in this suite.
suite.tests = [];
- suite._onlySuites.forEach(function(onlySuite) {
+ utils.forEach(suite._onlySuites, function(onlySuite) {
// If there are other `only` tests/suites nested in the current `only` suite, then filter that `only` suite.
// Otherwise, all of the tests on this `only` suite should be run, so don't filter it.
if (hasOnly(onlySuite)) {
@@ -5306,7 +5324,7 @@ function hasOnly(suite) {
function filterLeaks(ok, globals) {
return filter(globals, function(key) {
// Firefox and Chrome exposes iframes as index inside the window object
- if (/^d+/.test(key)) {
+ if (/^\d+/.test(key)) {
return false;
}
@@ -5868,7 +5886,8 @@ var basename = require('path').basename;
var debug = require('debug')('mocha:watch');
var exists = require('fs').existsSync || require('path').existsSync;
var glob = require('glob');
-var join = require('path').join;
+var path = require('path');
+var join = path.join;
var readdirSync = require('fs').readdirSync;
var statSync = require('fs').statSync;
var watchFile = require('fs').watchFile;
@@ -5948,7 +5967,7 @@ exports.map = function(arr, fn, scope) {
* @param {number} start
* @return {number}
*/
-exports.indexOf = function(arr, obj, start) {
+var indexOf = exports.indexOf = function(arr, obj, start) {
for (var i = start || 0, l = arr.length; i < l; i++) {
if (arr[i] === obj) {
return i;
@@ -5966,7 +5985,7 @@ exports.indexOf = function(arr, obj, start) {
* @param {Object} val Initial value.
* @return {*}
*/
-exports.reduce = function(arr, fn, val) {
+var reduce = exports.reduce = function(arr, fn, val) {
var rval = val;
for (var i = 0, l = arr.length; i < l; i++) {
@@ -6172,7 +6191,7 @@ exports.trim = function(str) {
* @return {Object}
*/
exports.parseQuery = function(qs) {
- return exports.reduce(qs.replace('?', '').split('&'), function(obj, pair) {
+ return reduce(qs.replace('?', '').split('&'), function(obj, pair) {
var i = pair.indexOf('=');
var key = pair.slice(0, i);
var val = pair.slice(++i);
@@ -6225,13 +6244,11 @@ exports.highlightTags = function(name) {
*
* @api private
* @param {*} value The value to inspect.
- * @param {string} [type] The type of the value, if known.
+ * @param {string} typeHint The type of the value
* @returns {string}
*/
-function emptyRepresentation(value, type) {
- type = type || exports.type(value);
-
- switch (type) {
+function emptyRepresentation(value, typeHint) {
+ switch (typeHint) {
case 'function':
return '[Function]';
case 'object':
@@ -6250,7 +6267,7 @@ function emptyRepresentation(value, type) {
* @api private
* @see https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Object/toString
* @param {*} value The value to test.
- * @returns {string}
+ * @returns {string} Computed type
* @example
* type({}) // 'object'
* type([]) // 'array'
@@ -6262,8 +6279,9 @@ function emptyRepresentation(value, type) {
* type(/foo/) // 'regexp'
* type('type') // 'string'
* type(global) // 'global'
+ * type(new String('foo') // 'object'
*/
-exports.type = function type(value) {
+var type = exports.type = function type(value) {
if (value === undefined) {
return 'undefined';
} else if (value === null) {
@@ -6292,25 +6310,36 @@ exports.type = function type(value) {
* @return {string}
*/
exports.stringify = function(value) {
- var type = exports.type(value);
-
- if (!~exports.indexOf(['object', 'array', 'function'], type)) {
- if (type !== 'buffer') {
+ var typeHint = type(value);
+
+ if (!~indexOf(['object', 'array', 'function'], typeHint)) {
+ if (typeHint === 'buffer') {
+ var json = value.toJSON();
+ // Based on the toJSON result
+ return jsonStringify(json.data && json.type ? json.data : json, 2)
+ .replace(/,(\n|$)/g, '$1');
+ }
+
+ // IE7/IE8 has a bizarre String constructor; needs to be coerced
+ // into an array and back to obj.
+ if (typeHint === 'string' && typeof value === 'object') {
+ value = reduce(value.split(''), function(acc, char, idx) {
+ acc[idx] = char;
+ return acc;
+ }, {});
+ typeHint = 'object';
+ } else {
return jsonStringify(value);
}
- var json = value.toJSON();
- // Based on the toJSON result
- return jsonStringify(json.data && json.type ? json.data : json, 2)
- .replace(/,(\n|$)/g, '$1');
}
for (var prop in value) {
if (Object.prototype.hasOwnProperty.call(value, prop)) {
- return jsonStringify(exports.canonicalize(value), 2).replace(/,(\n|$)/g, '$1');
+ return jsonStringify(exports.canonicalize(value, null, typeHint), 2).replace(/,(\n|$)/g, '$1');
}
}
- return emptyRepresentation(value, type);
+ return emptyRepresentation(value, typeHint);
};
/**
@@ -6339,7 +6368,7 @@ function jsonStringify(object, spaces, depth) {
}
function _stringify(val) {
- switch (exports.type(val)) {
+ switch (type(val)) {
case 'null':
case 'undefined':
val = '[' + val + ']';
@@ -6422,14 +6451,15 @@ exports.isBuffer = function(value) {
* @see {@link exports.stringify}
* @param {*} value Thing to inspect. May or may not have properties.
* @param {Array} [stack=[]] Stack of seen values
+ * @param {string} [typeHint] Type hint
* @return {(Object|Array|Function|string|undefined)}
*/
-exports.canonicalize = function(value, stack) {
+exports.canonicalize = function canonicalize(value, stack, typeHint) {
var canonicalizedObj;
/* eslint-disable no-unused-vars */
var prop;
/* eslint-enable no-unused-vars */
- var type = exports.type(value);
+ typeHint = typeHint || type(value);
function withStack(value, fn) {
stack.push(value);
fn();
@@ -6438,11 +6468,11 @@ exports.canonicalize = function(value, stack) {
stack = stack || [];
- if (exports.indexOf(stack, value) !== -1) {
+ if (indexOf(stack, value) !== -1) {
return '[Circular]';
}
- switch (type) {
+ switch (typeHint) {
case 'undefined':
case 'buffer':
case 'null':
@@ -6463,7 +6493,7 @@ exports.canonicalize = function(value, stack) {
}
/* eslint-enable guard-for-in */
if (!canonicalizedObj) {
- canonicalizedObj = emptyRepresentation(value, type);
+ canonicalizedObj = emptyRepresentation(value, typeHint);
break;
}
/* falls through */
@@ -6579,16 +6609,20 @@ exports.getError = function(err) {
*/
exports.stackTraceFilter = function() {
// TODO: Replace with `process.browser`
- var slash = '/';
var is = typeof document === 'undefined' ? { node: true } : { browser: true };
- var cwd = is.node
- ? process.cwd() + slash
- : (typeof location === 'undefined' ? window.location : location).href.replace(/\/[^\/]*$/, '/');
+ var slash = path.sep;
+ var cwd;
+ if (is.node) {
+ cwd = process.cwd() + slash;
+ } else {
+ cwd = (typeof location === 'undefined' ? window.location : location).href.replace(/\/[^\/]*$/, '/');
+ slash = '/';
+ }
function isMochaInternal(line) {
return (~line.indexOf('node_modules' + slash + 'mocha' + slash))
- || (~line.indexOf('components' + slash + 'mochajs' + slash))
- || (~line.indexOf('components' + slash + 'mocha' + slash))
+ || (~line.indexOf('node_modules' + slash + 'mocha.js'))
+ || (~line.indexOf('bower_components' + slash + 'mocha.js'))
|| (~line.indexOf(slash + 'mocha.js'));
}
@@ -6604,7 +6638,7 @@ exports.stackTraceFilter = function() {
return function(stack) {
stack = stack.split('\n');
- stack = exports.reduce(stack, function(list, line) {
+ stack = reduce(stack, function(list, line) {
if (isMochaInternal(line)) {
return list;
}
@@ -6637,7 +6671,7 @@ exports.isPromise = function isPromise(value) {
};
}).call(this,require('_process'),require("buffer").Buffer)
-},{"./to-iso-string":37,"_process":67,"buffer":44,"debug":2,"fs":42,"glob":42,"json3":54,"path":42,"util":82}],39:[function(require,module,exports){
+},{"./to-iso-string":37,"_process":67,"buffer":44,"debug":2,"fs":42,"glob":42,"json3":54,"path":42,"util":84}],39:[function(require,module,exports){
'use strict'
exports.toByteArray = toByteArray
@@ -6779,7 +6813,7 @@ BrowserStdout.prototype._write = function(chunks, encoding, cb) {
}
}).call(this,require('_process'))
-},{"_process":67,"stream":78,"util":82}],42:[function(require,module,exports){
+},{"_process":67,"stream":79,"util":84}],42:[function(require,module,exports){
arguments[4][40][0].apply(exports,arguments)
},{"dup":40}],43:[function(require,module,exports){
(function (global){
@@ -7062,6 +7096,8 @@ if (Buffer.TYPED_ARRAY_SUPPORT) {
function assertSize (size) {
if (typeof size !== 'number') {
throw new TypeError('"size" argument must be a number')
+ } else if (size < 0) {
+ throw new RangeError('"size" argument must not be negative')
}
}
@@ -7125,12 +7161,20 @@ function fromString (that, string, encoding) {
var length = byteLength(string, encoding) | 0
that = createBuffer(that, length)
- that.write(string, encoding)
+ var actual = that.write(string, encoding)
+
+ if (actual !== length) {
+ // Writing a hex string, for example, that contains invalid characters will
+ // cause everything after the first invalid character to be ignored. (e.g.
+ // 'abxxcd' will be treated as 'ab')
+ that = that.slice(0, actual)
+ }
+
return that
}
function fromArrayLike (that, array) {
- var length = checked(array.length) | 0
+ var length = array.length < 0 ? 0 : checked(array.length) | 0
that = createBuffer(that, length)
for (var i = 0; i < length; i += 1) {
that[i] = array[i] & 255
@@ -7149,7 +7193,9 @@ function fromArrayBuffer (that, array, byteOffset, length) {
throw new RangeError('\'length\' is out of bounds')
}
- if (length === undefined) {
+ if (byteOffset === undefined && length === undefined) {
+ array = new Uint8Array(array)
+ } else if (length === undefined) {
array = new Uint8Array(array, byteOffset)
} else {
array = new Uint8Array(array, byteOffset, length)
@@ -7197,7 +7243,7 @@ function fromObject (that, obj) {
}
function checked (length) {
- // Note: cannot use `length < kMaxLength` here because that fails when
+ // Note: cannot use `length < kMaxLength()` here because that fails when
// length is NaN (which is otherwise coerced to zero.)
if (length >= kMaxLength()) {
throw new RangeError('Attempt to allocate Buffer larger than maximum ' +
@@ -7246,9 +7292,9 @@ Buffer.isEncoding = function isEncoding (encoding) {
case 'utf8':
case 'utf-8':
case 'ascii':
+ case 'latin1':
case 'binary':
case 'base64':
- case 'raw':
case 'ucs2':
case 'ucs-2':
case 'utf16le':
@@ -7309,9 +7355,8 @@ function byteLength (string, encoding) {
for (;;) {
switch (encoding) {
case 'ascii':
+ case 'latin1':
case 'binary':
- case 'raw':
- case 'raws':
return len
case 'utf8':
case 'utf-8':
@@ -7384,8 +7429,9 @@ function slowToString (encoding, start, end) {
case 'ascii':
return asciiSlice(this, start, end)
+ case 'latin1':
case 'binary':
- return binarySlice(this, start, end)
+ return latin1Slice(this, start, end)
case 'base64':
return base64Slice(this, start, end)
@@ -7437,6 +7483,20 @@ Buffer.prototype.swap32 = function swap32 () {
return this
}
+Buffer.prototype.swap64 = function swap64 () {
+ var len = this.length
+ if (len % 8 !== 0) {
+ throw new RangeError('Buffer size must be a multiple of 64-bits')
+ }
+ for (var i = 0; i < len; i += 8) {
+ swap(this, i, i + 7)
+ swap(this, i + 1, i + 6)
+ swap(this, i + 2, i + 5)
+ swap(this, i + 3, i + 4)
+ }
+ return this
+}
+
Buffer.prototype.toString = function toString () {
var length = this.length | 0
if (length === 0) return ''
@@ -7519,7 +7579,73 @@ Buffer.prototype.compare = function compare (target, start, end, thisStart, this
return 0
}
-function arrayIndexOf (arr, val, byteOffset, encoding) {
+// Finds either the first index of `val` in `buffer` at offset >= `byteOffset`,
+// OR the last index of `val` in `buffer` at offset <= `byteOffset`.
+//
+// Arguments:
+// - buffer - a Buffer to search
+// - val - a string, Buffer, or number
+// - byteOffset - an index into `buffer`; will be clamped to an int32
+// - encoding - an optional encoding, relevant is val is a string
+// - dir - true for indexOf, false for lastIndexOf
+function bidirectionalIndexOf (buffer, val, byteOffset, encoding, dir) {
+ // Empty buffer means no match
+ if (buffer.length === 0) return -1
+
+ // Normalize byteOffset
+ if (typeof byteOffset === 'string') {
+ encoding = byteOffset
+ byteOffset = 0
+ } else if (byteOffset > 0x7fffffff) {
+ byteOffset = 0x7fffffff
+ } else if (byteOffset < -0x80000000) {
+ byteOffset = -0x80000000
+ }
+ byteOffset = +byteOffset // Coerce to Number.
+ if (isNaN(byteOffset)) {
+ // byteOffset: it it's undefined, null, NaN, "foo", etc, search whole buffer
+ byteOffset = dir ? 0 : (buffer.length - 1)
+ }
+
+ // Normalize byteOffset: negative offsets start from the end of the buffer
+ if (byteOffset < 0) byteOffset = buffer.length + byteOffset
+ if (byteOffset >= buffer.length) {
+ if (dir) return -1
+ else byteOffset = buffer.length - 1
+ } else if (byteOffset < 0) {
+ if (dir) byteOffset = 0
+ else return -1
+ }
+
+ // Normalize val
+ if (typeof val === 'string') {
+ val = Buffer.from(val, encoding)
+ }
+
+ // Finally, search either indexOf (if dir is true) or lastIndexOf
+ if (Buffer.isBuffer(val)) {
+ // Special case: looking for empty string/buffer always fails
+ if (val.length === 0) {
+ return -1
+ }
+ return arrayIndexOf(buffer, val, byteOffset, encoding, dir)
+ } else if (typeof val === 'number') {
+ val = val & 0xFF // Search for a byte value [0-255]
+ if (Buffer.TYPED_ARRAY_SUPPORT &&
+ typeof Uint8Array.prototype.indexOf === 'function') {
+ if (dir) {
+ return Uint8Array.prototype.indexOf.call(buffer, val, byteOffset)
+ } else {
+ return Uint8Array.prototype.lastIndexOf.call(buffer, val, byteOffset)
+ }
+ }
+ return arrayIndexOf(buffer, [ val ], byteOffset, encoding, dir)
+ }
+
+ throw new TypeError('val must be string, number or Buffer')
+}
+
+function arrayIndexOf (arr, val, byteOffset, encoding, dir) {
var indexSize = 1
var arrLength = arr.length
var valLength = val.length
@@ -7546,60 +7672,45 @@ function arrayIndexOf (arr, val, byteOffset, encoding) {
}
}
- var foundIndex = -1
- for (var i = byteOffset; i < arrLength; ++i) {
- if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
- if (foundIndex === -1) foundIndex = i
- if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
- } else {
- if (foundIndex !== -1) i -= i - foundIndex
- foundIndex = -1
+ var i
+ if (dir) {
+ var foundIndex = -1
+ for (i = byteOffset; i < arrLength; i++) {
+ if (read(arr, i) === read(val, foundIndex === -1 ? 0 : i - foundIndex)) {
+ if (foundIndex === -1) foundIndex = i
+ if (i - foundIndex + 1 === valLength) return foundIndex * indexSize
+ } else {
+ if (foundIndex !== -1) i -= i - foundIndex
+ foundIndex = -1
+ }
+ }
+ } else {
+ if (byteOffset + valLength > arrLength) byteOffset = arrLength - valLength
+ for (i = byteOffset; i >= 0; i--) {
+ var found = true
+ for (var j = 0; j < valLength; j++) {
+ if (read(arr, i + j) !== read(val, j)) {
+ found = false
+ break
+ }
+ }
+ if (found) return i
}
}
return -1
}
-Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
- if (typeof byteOffset === 'string') {
- encoding = byteOffset
- byteOffset = 0
- } else if (byteOffset > 0x7fffffff) {
- byteOffset = 0x7fffffff
- } else if (byteOffset < -0x80000000) {
- byteOffset = -0x80000000
- }
- byteOffset >>= 0
-
- if (this.length === 0) return -1
- if (byteOffset >= this.length) return -1
-
- // Negative offsets start from the end of the buffer
- if (byteOffset < 0) byteOffset = Math.max(this.length + byteOffset, 0)
-
- if (typeof val === 'string') {
- val = Buffer.from(val, encoding)
- }
-
- if (Buffer.isBuffer(val)) {
- // special case: looking for empty string/buffer always fails
- if (val.length === 0) {
- return -1
- }
- return arrayIndexOf(this, val, byteOffset, encoding)
- }
- if (typeof val === 'number') {
- if (Buffer.TYPED_ARRAY_SUPPORT && Uint8Array.prototype.indexOf === 'function') {
- return Uint8Array.prototype.indexOf.call(this, val, byteOffset)
- }
- return arrayIndexOf(this, [ val ], byteOffset, encoding)
- }
+Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
+ return this.indexOf(val, byteOffset, encoding) !== -1
+}
- throw new TypeError('val must be string, number or Buffer')
+Buffer.prototype.indexOf = function indexOf (val, byteOffset, encoding) {
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, true)
}
-Buffer.prototype.includes = function includes (val, byteOffset, encoding) {
- return this.indexOf(val, byteOffset, encoding) !== -1
+Buffer.prototype.lastIndexOf = function lastIndexOf (val, byteOffset, encoding) {
+ return bidirectionalIndexOf(this, val, byteOffset, encoding, false)
}
function hexWrite (buf, string, offset, length) {
@@ -7616,7 +7727,7 @@ function hexWrite (buf, string, offset, length) {
// must be an even number of digits
var strLen = string.length
- if (strLen % 2 !== 0) throw new Error('Invalid hex string')
+ if (strLen % 2 !== 0) throw new TypeError('Invalid hex string')
if (length > strLen / 2) {
length = strLen / 2
@@ -7637,7 +7748,7 @@ function asciiWrite (buf, string, offset, length) {
return blitBuffer(asciiToBytes(string), buf, offset, length)
}
-function binaryWrite (buf, string, offset, length) {
+function latin1Write (buf, string, offset, length) {
return asciiWrite(buf, string, offset, length)
}
@@ -7699,8 +7810,9 @@ Buffer.prototype.write = function write (string, offset, length, encoding) {
case 'ascii':
return asciiWrite(this, string, offset, length)
+ case 'latin1':
case 'binary':
- return binaryWrite(this, string, offset, length)
+ return latin1Write(this, string, offset, length)
case 'base64':
// Warning: maxLength not taken into account in base64Write
@@ -7841,7 +7953,7 @@ function asciiSlice (buf, start, end) {
return ret
}
-function binarySlice (buf, start, end) {
+function latin1Slice (buf, start, end) {
var ret = ''
end = Math.min(buf.length, end)
@@ -10063,22 +10175,26 @@ if (typeof Object.create === 'function') {
}
},{}],52:[function(require,module,exports){
-/**
- * Determine if an object is Buffer
- *
- * Author: Feross Aboukhadijeh <[email protected]> <http://feross.org>
- * License: MIT
+/*!
+ * Determine if an object is a Buffer
*
- * `npm install is-buffer`
+ * @author Feross Aboukhadijeh <[email protected]> <http://feross.org>
+ * @license MIT
*/
+// The _isBuffer check is for Safari 5-7 support, because it's missing
+// Object.prototype.constructor. Remove this eventually
module.exports = function (obj) {
- return !!(obj != null &&
- (obj._isBuffer || // For Safari 5-7 (missing Object.prototype.constructor)
- (obj.constructor &&
- typeof obj.constructor.isBuffer === 'function' &&
- obj.constructor.isBuffer(obj))
- ))
+ return obj != null && (isBuffer(obj) || isSlowBuffer(obj) || !!obj._isBuffer)
+}
+
+function isBuffer (obj) {
+ return !!obj.constructor && typeof obj.constructor.isBuffer === 'function' && obj.constructor.isBuffer(obj)
+}
+
+// For Node v0.10 support. Remove this eventually.
+function isSlowBuffer (obj) {
+ return typeof obj.readFloatLE === 'function' && typeof obj.slice === 'function' && isBuffer(obj.slice(0, 0))
}
},{}],53:[function(require,module,exports){
@@ -11448,12 +11564,12 @@ module.exports = create;
},{"lodash._baseassign":55,"lodash._basecreate":57,"lodash._isiterateecall":59}],61:[function(require,module,exports){
/**
- * lodash 3.0.8 (Custom Build) <https://lodash.com/>
+ * lodash (Custom Build) <https://lodash.com/>
* Build: `lodash modularize exports="npm" -o ./`
- * Copyright 2012-2016 The Dojo Foundation <http://dojofoundation.org/>
+ * Copyright jQuery Foundation and other contributors <https://jquery.org/>
+ * Released under MIT license <https://lodash.com/license>
* Based on Underscore.js 1.8.3 <http://underscorejs.org/LICENSE>
- * Copyright 2009-2016 Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
- * Available under MIT license <https://lodash.com/license>
+ * Copyright Jeremy Ashkenas, DocumentCloud and Investigative Reporters & Editors
*/
/** Used as references for various `Number` constants. */
@@ -11471,7 +11587,8 @@ var objectProto = Object.prototype;
var hasOwnProperty = objectProto.hasOwnProperty;
/**
- * Used to resolve the [`toStringTag`](http://ecma-international.org/ecma-262/6.0/#sec-object.prototype.tostring)
+ * Used to resolve the
+ * [`toStringTag`](http://ecma-international.org/ecma-262/7.0/#sec-object.prototype.tostring)
* of values.
*/
var objectToString = objectProto.toString;
@@ -11479,39 +11596,16 @@ var objectToString = objectProto.toString;
/** Built-in value references. */
var propertyIsEnumerable = objectProto.propertyIsEnumerable;
-/**
- * The base implementation of `_.property` without support for deep paths.
- *
- * @private
- * @param {string} key The key of the property to get.
- * @returns {Function} Returns the new function.
- */
-function baseProperty(key) {
- return function(object) {
- return object == null ? undefined : object[key];
- };
-}
-
-/**
- * Gets the "length" property value of `object`.
- *
- * **Note:** This function is used to avoid a [JIT bug](https://bugs.webkit.org/show_bug.cgi?id=142792)
- * that affects Safari on at least iOS 8.1-8.3 ARM64.
- *
- * @private
- * @param {Object} object The object to query.
- * @returns {*} Returns the "length" value.
- */
-var getLength = baseProperty('length');
-
/**
* Checks if `value` is likely an `arguments` object.
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is an `arguments` object,
+ * else `false`.
* @example
*
* _.isArguments(function() { return arguments; }());
@@ -11521,7 +11615,7 @@ var getLength = baseProperty('length');
* // => false
*/
function isArguments(value) {
- // Safari 8.1 incorrectly makes `arguments.callee` enumerable in strict mode.
+ // Safari 8.1 makes `arguments.callee` enumerable in strict mode.
return isArrayLikeObject(value) && hasOwnProperty.call(value, 'callee') &&
(!propertyIsEnumerable.call(value, 'callee') || objectToString.call(value) == argsTag);
}
@@ -11533,6 +11627,7 @@ function isArguments(value) {
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is array-like, else `false`.
@@ -11551,7 +11646,7 @@ function isArguments(value) {
* // => false
*/
function isArrayLike(value) {
- return value != null && isLength(getLength(value)) && !isFunction(value);
+ return value != null && isLength(value.length) && !isFunction(value);
}
/**
@@ -11560,9 +11655,11 @@ function isArrayLike(value) {
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is an array-like object, else `false`.
+ * @returns {boolean} Returns `true` if `value` is an array-like object,
+ * else `false`.
* @example
*
* _.isArrayLikeObject([1, 2, 3]);
@@ -11586,9 +11683,10 @@ function isArrayLikeObject(value) {
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
- * @returns {boolean} Returns `true` if `value` is correctly classified, else `false`.
+ * @returns {boolean} Returns `true` if `value` is a function, else `false`.
* @example
*
* _.isFunction(_);
@@ -11599,8 +11697,7 @@ function isArrayLikeObject(value) {
*/
function isFunction(value) {
// The use of `Object#toString` avoids issues with the `typeof` operator
- // in Safari 8 which returns 'object' for typed array and weak map constructors,
- // and PhantomJS 1.9 which returns 'function' for `NodeList` instances.
+ // in Safari 8-9 which returns 'object' for typed array and other constructors.
var tag = isObject(value) ? objectToString.call(value) : '';
return tag == funcTag || tag == genTag;
}
@@ -11608,10 +11705,12 @@ function isFunction(value) {
/**
* Checks if `value` is a valid array-like length.
*
- * **Note:** This function is loosely based on [`ToLength`](http://ecma-international.org/ecma-262/6.0/#sec-tolength).
+ * **Note:** This method is loosely based on
+ * [`ToLength`](http://ecma-international.org/ecma-262/7.0/#sec-tolength).
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is a valid length, else `false`.
@@ -11635,11 +11734,13 @@ function isLength(value) {
}
/**
- * Checks if `value` is the [language type](https://es5.github.io/#x8) of `Object`.
- * (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
+ * Checks if `value` is the
+ * [language type](http://www.ecma-international.org/ecma-262/7.0/#sec-ecmascript-language-types)
+ * of `Object`. (e.g. arrays, functions, objects, regexes, `new Number(0)`, and `new String('')`)
*
* @static
* @memberOf _
+ * @since 0.1.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is an object, else `false`.
@@ -11668,6 +11769,7 @@ function isObject(value) {
*
* @static
* @memberOf _
+ * @since 4.0.0
* @category Lang
* @param {*} value The value to check.
* @returns {boolean} Returns `true` if `value` is object-like, else `false`.
@@ -12309,7 +12411,6 @@ function nextTick(fn, arg1, arg2, arg3) {
}).call(this,require('_process'))
},{"_process":67}],67:[function(require,module,exports){
// shim for using process in browser
-
var process = module.exports = {};
// cached from whatever global is present so that test runners that stub it
@@ -12320,22 +12421,84 @@ var process = module.exports = {};
var cachedSetTimeout;
var cachedClearTimeout;
+function defaultSetTimout() {
+ throw new Error('setTimeout has not been defined');
+}
+function defaultClearTimeout () {
+ throw new Error('clearTimeout has not been defined');
+}
(function () {
- try {
- cachedSetTimeout = setTimeout;
- } catch (e) {
- cachedSetTimeout = function () {
- throw new Error('setTimeout is not defined');
+ try {
+ if (typeof setTimeout === 'function') {
+ cachedSetTimeout = setTimeout;
+ } else {
+ cachedSetTimeout = defaultSetTimout;
+ }
+ } catch (e) {
+ cachedSetTimeout = defaultSetTimout;
}
- }
- try {
- cachedClearTimeout = clearTimeout;
- } catch (e) {
- cachedClearTimeout = function () {
- throw new Error('clearTimeout is not defined');
+ try {
+ if (typeof clearTimeout === 'function') {
+ cachedClearTimeout = clearTimeout;
+ } else {
+ cachedClearTimeout = defaultClearTimeout;
+ }
+ } catch (e) {
+ cachedClearTimeout = defaultClearTimeout;
}
- }
} ())
+function runTimeout(fun) {
+ if (cachedSetTimeout === setTimeout) {
+ //normal enviroments in sane situations
+ return setTimeout(fun, 0);
+ }
+ // if setTimeout wasn't available but was latter defined
+ if ((cachedSetTimeout === defaultSetTimout || !cachedSetTimeout) && setTimeout) {
+ cachedSetTimeout = setTimeout;
+ return setTimeout(fun, 0);
+ }
+ try {
+ // when when somebody has screwed with setTimeout but no I.E. maddness
+ return cachedSetTimeout(fun, 0);
+ } catch(e){
+ try {
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
+ return cachedSetTimeout.call(null, fun, 0);
+ } catch(e){
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error
+ return cachedSetTimeout.call(this, fun, 0);
+ }
+ }
+
+
+}
+function runClearTimeout(marker) {
+ if (cachedClearTimeout === clearTimeout) {
+ //normal enviroments in sane situations
+ return clearTimeout(marker);
+ }
+ // if clearTimeout wasn't available but was latter defined
+ if ((cachedClearTimeout === defaultClearTimeout || !cachedClearTimeout) && clearTimeout) {
+ cachedClearTimeout = clearTimeout;
+ return clearTimeout(marker);
+ }
+ try {
+ // when when somebody has screwed with setTimeout but no I.E. maddness
+ return cachedClearTimeout(marker);
+ } catch (e){
+ try {
+ // When we are in I.E. but the script has been evaled so I.E. doesn't trust the global object when called normally
+ return cachedClearTimeout.call(null, marker);
+ } catch (e){
+ // same as above but when it's a version of I.E. that must have the global object for 'this', hopfully our context correct otherwise it will throw a global error.
+ // Some versions of I.E. have different rules for clearTimeout vs setTimeout
+ return cachedClearTimeout.call(this, marker);
+ }
+ }
+
+
+
+}
var queue = [];
var draining = false;
var currentQueue;
@@ -12360,7 +12523,7 @@ function drainQueue() {
if (draining) {
return;
}
- var timeout = cachedSetTimeout(cleanUpNextTick);
+ var timeout = runTimeout(cleanUpNextTick);
draining = true;
var len = queue.length;
@@ -12377,7 +12540,7 @@ function drainQueue() {
}
currentQueue = null;
draining = false;
- cachedClearTimeout(timeout);
+ runClearTimeout(timeout);
}
process.nextTick = function (fun) {
@@ -12389,7 +12552,7 @@ process.nextTick = function (fun) {
}
queue.push(new Item(fun, args));
if (queue.length === 1 && !draining) {
- cachedSetTimeout(drainQueue, 0);
+ runTimeout(drainQueue);
}
};
@@ -12589,21 +12752,21 @@ if (debugUtil && debugUtil.debuglog) {
}
/*</replacement>*/
+var BufferList = require('./internal/streams/BufferList');
var StringDecoder;
util.inherits(Readable, Stream);
-var hasPrependListener = typeof EE.prototype.prependListener === 'function';
-
function prependListener(emitter, event, fn) {
- if (hasPrependListener) return emitter.prependListener(event, fn);
-
- // This is a brutally ugly hack to make sure that our error handler
- // is attached before any userland ones. NEVER DO THIS. This is here
- // only because this code needs to continue to work with older versions
- // of Node.js that do not include the prependListener() method. The goal
- // is to eventually remove this hack.
- if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
+ if (typeof emitter.prependListener === 'function') {
+ return emitter.prependListener(event, fn);
+ } else {
+ // This is a hack to make sure that our error handler is attached before any
+ // userland ones. NEVER DO THIS. This is here only because this code needs
+ // to continue to work with older versions of Node.js that do not include
+ // the prependListener() method. The goal is to eventually remove this hack.
+ if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
+ }
}
var Duplex;
@@ -12627,7 +12790,10 @@ function ReadableState(options, stream) {
// cast to ints.
this.highWaterMark = ~ ~this.highWaterMark;
- this.buffer = [];
+ // A linked list is used to store data chunks instead of an array because the
+ // linked list can remove elements from the beginning faster than
+ // array.shift()
+ this.buffer = new BufferList();
this.length = 0;
this.pipes = null;
this.pipesCount = 0;
@@ -12790,7 +12956,8 @@ function computeNewHighWaterMark(n) {
if (n >= MAX_HWM) {
n = MAX_HWM;
} else {
- // Get the next highest power of 2
+ // Get the next highest power of 2 to prevent increasing hwm excessively in
+ // tiny amounts
n--;
n |= n >>> 1;
n |= n >>> 2;
@@ -12802,44 +12969,34 @@ function computeNewHighWaterMark(n) {
return n;
}
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
function howMuchToRead(n, state) {
- if (state.length === 0 && state.ended) return 0;
-
- if (state.objectMode) return n === 0 ? 0 : 1;
-
- if (n === null || isNaN(n)) {
- // only flow one buffer at a time
- if (state.flowing && state.buffer.length) return state.buffer[0].length;else return state.length;
+ if (n <= 0 || state.length === 0 && state.ended) return 0;
+ if (state.objectMode) return 1;
+ if (n !== n) {
+ // Only flow one buffer at a time
+ if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
}
-
- if (n <= 0) return 0;
-
- // If we're asking for more than the target buffer level,
- // then raise the water mark. Bump up to the next highest
- // power of 2, to prevent increasing it excessively in tiny
- // amounts.
+ // If we're asking for more than the current hwm, then raise the hwm.
if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
-
- // don't have that much. return null, unless we've ended.
- if (n > state.length) {
- if (!state.ended) {
- state.needReadable = true;
- return 0;
- } else {
- return state.length;
- }
+ if (n <= state.length) return n;
+ // Don't have enough
+ if (!state.ended) {
+ state.needReadable = true;
+ return 0;
}
-
- return n;
+ return state.length;
}
// you can override either this method, or the async _read(n) below.
Readable.prototype.read = function (n) {
debug('read', n);
+ n = parseInt(n, 10);
var state = this._readableState;
var nOrig = n;
- if (typeof n !== 'number' || n > 0) state.emittedReadable = false;
+ if (n !== 0) state.emittedReadable = false;
// if we're doing read(0) to trigger a readable event, but we
// already have a bunch of data in the buffer, then just trigger
@@ -12895,9 +13052,7 @@ Readable.prototype.read = function (n) {
if (state.ended || state.reading) {
doRead = false;
debug('reading or ended', doRead);
- }
-
- if (doRead) {
+ } else if (doRead) {
debug('do read');
state.reading = true;
state.sync = true;
@@ -12906,28 +13061,29 @@ Readable.prototype.read = function (n) {
// call internal read method
this._read(state.highWaterMark);
state.sync = false;
+ // If _read pushed data synchronously, then `reading` will be false,
+ // and we need to re-evaluate how much data we can return to the user.
+ if (!state.reading) n = howMuchToRead(nOrig, state);
}
- // If _read pushed data synchronously, then `reading` will be false,
- // and we need to re-evaluate how much data we can return to the user.
- if (doRead && !state.reading) n = howMuchToRead(nOrig, state);
-
var ret;
if (n > 0) ret = fromList(n, state);else ret = null;
if (ret === null) {
state.needReadable = true;
n = 0;
+ } else {
+ state.length -= n;
}
- state.length -= n;
-
- // If we have nothing in the buffer, then we want to know
- // as soon as we *do* get something into the buffer.
- if (state.length === 0 && !state.ended) state.needReadable = true;
+ if (state.length === 0) {
+ // If we have nothing in the buffer, then we want to know
+ // as soon as we *do* get something into the buffer.
+ if (!state.ended) state.needReadable = true;
- // If we tried to read() past the EOF, then emit end on the next tick.
- if (nOrig !== n && state.ended && state.length === 0) endReadable(this);
+ // If we tried to read() past the EOF, then emit end on the next tick.
+ if (nOrig !== n && state.ended) endReadable(this);
+ }
if (ret !== null) this.emit('data', ret);
@@ -13075,11 +13231,17 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
}
+ // If the user pushes more data while we're writing to dest then we'll end up
+ // in ondata again. However, we only want to increase awaitDrain once because
+ // dest will only emit one 'drain' event for the multiple writes.
+ // => Introduce a guard on increasing awaitDrain.
+ var increasedAwaitDrain = false;
src.on('data', ondata);
function ondata(chunk) {
debug('ondata');
+ increasedAwaitDrain = false;
var ret = dest.write(chunk);
- if (false === ret) {
+ if (false === ret && !increasedAwaitDrain) {
// If the user unpiped during `dest.write()`, it is possible
// to get stuck in a permanently paused state if that write
// also returned false.
@@ -13087,6 +13249,7 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
debug('false write response, pause', src._readableState.awaitDrain);
src._readableState.awaitDrain++;
+ increasedAwaitDrain = true;
}
src.pause();
}
@@ -13200,18 +13363,14 @@ Readable.prototype.unpipe = function (dest) {
Readable.prototype.on = function (ev, fn) {
var res = Stream.prototype.on.call(this, ev, fn);
- // If listening to data, and it has not explicitly been paused,
- // then call resume to start the flow of data on the next tick.
- if (ev === 'data' && false !== this._readableState.flowing) {
- this.resume();
- }
-
- if (ev === 'readable' && !this._readableState.endEmitted) {
+ if (ev === 'data') {
+ // Start flowing on next tick if stream isn't explicitly paused
+ if (this._readableState.flowing !== false) this.resume();
+ } else if (ev === 'readable') {
var state = this._readableState;
- if (!state.readableListening) {
- state.readableListening = true;
+ if (!state.endEmitted && !state.readableListening) {
+ state.readableListening = state.needReadable = true;
state.emittedReadable = false;
- state.needReadable = true;
if (!state.reading) {
processNextTick(nReadingNextTick, this);
} else if (state.length) {
@@ -13255,6 +13414,7 @@ function resume_(stream, state) {
}
state.resumeScheduled = false;
+ state.awaitDrain = 0;
stream.emit('resume');
flow(stream);
if (state.flowing && !state.reading) stream.read(0);
@@ -13273,11 +13433,7 @@ Readable.prototype.pause = function () {
function flow(stream) {
var state = stream._readableState;
debug('flow', state.flowing);
- if (state.flowing) {
- do {
- var chunk = stream.read();
- } while (null !== chunk && state.flowing);
- }
+ while (state.flowing && stream.read() !== null) {}
}
// wrap an old-style stream as the async data source.
@@ -13348,50 +13504,101 @@ Readable._fromList = fromList;
// Pluck off n bytes from an array of buffers.
// Length is the combined lengths of all the buffers in the list.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
function fromList(n, state) {
- var list = state.buffer;
- var length = state.length;
- var stringMode = !!state.decoder;
- var objectMode = !!state.objectMode;
- var ret;
-
- // nothing in the list, definitely empty.
- if (list.length === 0) return null;
+ // nothing buffered
+ if (state.length === 0) return null;
- if (length === 0) ret = null;else if (objectMode) ret = list.shift();else if (!n || n >= length) {
- // read it all, truncate the array.
- if (stringMode) ret = list.join('');else if (list.length === 1) ret = list[0];else ret = Buffer.concat(list, length);
- list.length = 0;
+ var ret;
+ if (state.objectMode) ret = state.buffer.shift();else if (!n || n >= state.length) {
+ // read it all, truncate the list
+ if (state.decoder) ret = state.buffer.join('');else if (state.buffer.length === 1) ret = state.buffer.head.data;else ret = state.buffer.concat(state.length);
+ state.buffer.clear();
} else {
- // read just some of it.
- if (n < list[0].length) {
- // just take a part of the first list item.
- // slice is the same for buffers and strings.
- var buf = list[0];
- ret = buf.slice(0, n);
- list[0] = buf.slice(n);
- } else if (n === list[0].length) {
- // first list is a perfect match
- ret = list.shift();
- } else {
- // complex case.
- // we have enough to cover it, but it spans past the first buffer.
- if (stringMode) ret = '';else ret = bufferShim.allocUnsafe(n);
-
- var c = 0;
- for (var i = 0, l = list.length; i < l && c < n; i++) {
- var _buf = list[0];
- var cpy = Math.min(n - c, _buf.length);
+ // read part of list
+ ret = fromListPartial(n, state.buffer, state.decoder);
+ }
- if (stringMode) ret += _buf.slice(0, cpy);else _buf.copy(ret, c, 0, cpy);
+ return ret;
+}
- if (cpy < _buf.length) list[0] = _buf.slice(cpy);else list.shift();
+// Extracts only enough buffered data to satisfy the amount requested.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function fromListPartial(n, list, hasStrings) {
+ var ret;
+ if (n < list.head.data.length) {
+ // slice is the same for buffers and strings
+ ret = list.head.data.slice(0, n);
+ list.head.data = list.head.data.slice(n);
+ } else if (n === list.head.data.length) {
+ // first chunk is a perfect match
+ ret = list.shift();
+ } else {
+ // result spans more than one buffer
+ ret = hasStrings ? copyFromBufferString(n, list) : copyFromBuffer(n, list);
+ }
+ return ret;
+}
- c += cpy;
+// Copies a specified amount of characters from the list of buffered data
+// chunks.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function copyFromBufferString(n, list) {
+ var p = list.head;
+ var c = 1;
+ var ret = p.data;
+ n -= ret.length;
+ while (p = p.next) {
+ var str = p.data;
+ var nb = n > str.length ? str.length : n;
+ if (nb === str.length) ret += str;else ret += str.slice(0, n);
+ n -= nb;
+ if (n === 0) {
+ if (nb === str.length) {
+ ++c;
+ if (p.next) list.head = p.next;else list.head = list.tail = null;
+ } else {
+ list.head = p;
+ p.data = str.slice(nb);
}
+ break;
}
+ ++c;
}
+ list.length -= c;
+ return ret;
+}
+// Copies a specified amount of bytes from the list of buffered data chunks.
+// This function is designed to be inlinable, so please take care when making
+// changes to the function body.
+function copyFromBuffer(n, list) {
+ var ret = bufferShim.allocUnsafe(n);
+ var p = list.head;
+ var c = 1;
+ p.data.copy(ret);
+ n -= p.data.length;
+ while (p = p.next) {
+ var buf = p.data;
+ var nb = n > buf.length ? buf.length : n;
+ buf.copy(ret, ret.length - n, 0, nb);
+ n -= nb;
+ if (n === 0) {
+ if (nb === buf.length) {
+ ++c;
+ if (p.next) list.head = p.next;else list.head = list.tail = null;
+ } else {
+ list.head = p;
+ p.data = buf.slice(nb);
+ }
+ break;
+ }
+ ++c;
+ }
+ list.length -= c;
return ret;
}
@@ -13430,7 +13637,7 @@ function indexOf(xs, x) {
return -1;
}
}).call(this,require('_process'))
-},{"./_stream_duplex":69,"_process":67,"buffer":44,"buffer-shims":43,"core-util-is":45,"events":48,"inherits":51,"isarray":53,"process-nextick-args":66,"string_decoder/":79,"util":40}],72:[function(require,module,exports){
+},{"./_stream_duplex":69,"./internal/streams/BufferList":74,"_process":67,"buffer":44,"buffer-shims":43,"core-util-is":45,"events":48,"inherits":51,"isarray":53,"process-nextick-args":66,"string_decoder/":80,"util":40}],72:[function(require,module,exports){
// a transform stream is a readable/writable stream where you do
// something with the data. Sometimes it's called a "filter",
// but that's not a great name for it, since that implies a thing where
@@ -14140,10 +14347,75 @@ function CorkedRequest(state) {
};
}
}).call(this,require('_process'))
-},{"./_stream_duplex":69,"_process":67,"buffer":44,"buffer-shims":43,"core-util-is":45,"events":48,"inherits":51,"process-nextick-args":66,"util-deprecate":80}],74:[function(require,module,exports){
+},{"./_stream_duplex":69,"_process":67,"buffer":44,"buffer-shims":43,"core-util-is":45,"events":48,"inherits":51,"process-nextick-args":66,"util-deprecate":81}],74:[function(require,module,exports){
+'use strict';
+
+var Buffer = require('buffer').Buffer;
+/*<replacement>*/
+var bufferShim = require('buffer-shims');
+/*</replacement>*/
+
+module.exports = BufferList;
+
+function BufferList() {
+ this.head = null;
+ this.tail = null;
+ this.length = 0;
+}
+
+BufferList.prototype.push = function (v) {
+ var entry = { data: v, next: null };
+ if (this.length > 0) this.tail.next = entry;else this.head = entry;
+ this.tail = entry;
+ ++this.length;
+};
+
+BufferList.prototype.unshift = function (v) {
+ var entry = { data: v, next: this.head };
+ if (this.length === 0) this.tail = entry;
+ this.head = entry;
+ ++this.length;
+};
+
+BufferList.prototype.shift = function () {
+ if (this.length === 0) return;
+ var ret = this.head.data;
+ if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
+ --this.length;
+ return ret;
+};
+
+BufferList.prototype.clear = function () {
+ this.head = this.tail = null;
+ this.length = 0;
+};
+
+BufferList.prototype.join = function (s) {
+ if (this.length === 0) return '';
+ var p = this.head;
+ var ret = '' + p.data;
+ while (p = p.next) {
+ ret += s + p.data;
+ }return ret;
+};
+
+BufferList.prototype.concat = function (n) {
+ if (this.length === 0) return bufferShim.alloc(0);
+ if (this.length === 1) return this.head.data;
+ var ret = bufferShim.allocUnsafe(n >>> 0);
+ var p = this.head;
+ var i = 0;
+ while (p) {
+ p.data.copy(ret, i);
+ i += p.data.length;
+ p = p.next;
+ }
+ return ret;
+};
+},{"buffer":44,"buffer-shims":43}],75:[function(require,module,exports){
module.exports = require("./lib/_stream_passthrough.js")
-},{"./lib/_stream_passthrough.js":70}],75:[function(require,module,exports){
+},{"./lib/_stream_passthrough.js":70}],76:[function(require,module,exports){
(function (process){
var Stream = (function (){
try {
@@ -14163,13 +14435,13 @@ if (!process.browser && process.env.READABLE_STREAM === 'disable' && Stream) {
}
}).call(this,require('_process'))
-},{"./lib/_stream_duplex.js":69,"./lib/_stream_passthrough.js":70,"./lib/_stream_readable.js":71,"./lib/_stream_transform.js":72,"./lib/_stream_writable.js":73,"_process":67}],76:[function(require,module,exports){
+},{"./lib/_stream_duplex.js":69,"./lib/_stream_passthrough.js":70,"./lib/_stream_readable.js":71,"./lib/_stream_transform.js":72,"./lib/_stream_writable.js":73,"_process":67}],77:[function(require,module,exports){
module.exports = require("./lib/_stream_transform.js")
-},{"./lib/_stream_transform.js":72}],77:[function(require,module,exports){
+},{"./lib/_stream_transform.js":72}],78:[function(require,module,exports){
module.exports = require("./lib/_stream_writable.js")
-},{"./lib/_stream_writable.js":73}],78:[function(require,module,exports){
+},{"./lib/_stream_writable.js":73}],79:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -14298,7 +14570,7 @@ Stream.prototype.pipe = function(dest, options) {
return dest;
};
-},{"events":48,"inherits":51,"readable-stream/duplex.js":68,"readable-stream/passthrough.js":74,"readable-stream/readable.js":75,"readable-stream/transform.js":76,"readable-stream/writable.js":77}],79:[function(require,module,exports){
+},{"events":48,"inherits":51,"readable-stream/duplex.js":68,"readable-stream/passthrough.js":75,"readable-stream/readable.js":76,"readable-stream/transform.js":77,"readable-stream/writable.js":78}],80:[function(require,module,exports){
// Copyright Joyent, Inc. and other Node contributors.
//
// Permission is hereby granted, free of charge, to any person obtaining a
@@ -14521,7 +14793,7 @@ function base64DetectIncompleteChar(buffer) {
this.charLength = this.charReceived ? 3 : 0;
}
-},{"buffer":44}],80:[function(require,module,exports){
+},{"buffer":44}],81:[function(require,module,exports){
(function (global){
/**
@@ -14592,14 +14864,16 @@ function config (name) {
}
}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{}],81:[function(require,module,exports){
+},{}],82:[function(require,module,exports){
+arguments[4][51][0].apply(exports,arguments)
+},{"dup":51}],83:[function(require,module,exports){
module.exports = function isBuffer(arg) {
return arg && typeof arg === 'object'
&& typeof arg.copy === 'function'
&& typeof arg.fill === 'function'
&& typeof arg.readUInt8 === 'function';
}
-},{}],82:[function(require,module,exports){
+},{}],84:[function(require,module,exports){
(function (process,global){
// Copyright Joyent, Inc. and other Node contributors.
//
@@ -15189,4 +15463,4 @@ function hasOwnProperty(obj, prop) {
}
}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
-},{"./support/isBuffer":81,"_process":67,"inherits":51}]},{},[1]);
+},{"./support/isBuffer":83,"_process":67,"inherits":82}]},{},[1]);