@contrast/agent 4.32.11 → 4.32.13
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/lib/core/config/util.js +2 -1
- package/node_modules/file-stream-rotator/FileStreamRotator.js +200 -41
- package/node_modules/file-stream-rotator/LICENSE.txt +17 -0
- package/node_modules/file-stream-rotator/README.md +16 -1
- package/node_modules/file-stream-rotator/package.json +5 -5
- package/node_modules/file-stream-rotator/tests/every-minute-test.js +32 -15
- package/node_modules/file-stream-rotator/tests/every-second-test.js +16 -7
- package/node_modules/file-stream-rotator/tests/large-test.js +33 -0
- package/node_modules/file-stream-rotator/tests/rotate-on-size-without-date.js +103 -0
- package/node_modules/object-hash/dist/object_hash.js +1 -2
- package/node_modules/object-hash/index.js +33 -21
- package/node_modules/object-hash/package.json +20 -18
- package/node_modules/object-hash/readme.markdown +20 -5
- package/node_modules/winston-daily-rotate-file/README.md +81 -12
- package/node_modules/winston-daily-rotate-file/daily-rotate-file.js +69 -30
- package/node_modules/winston-daily-rotate-file/index.d.ts +119 -72
- package/node_modules/winston-daily-rotate-file/package.json +20 -19
- package/node_modules/winston-transport/.eslintrc +1 -1
- package/node_modules/winston-transport/.nyc_output/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
- package/node_modules/winston-transport/.nyc_output/processinfo/c3d7ddb9-cc26-466b-a4f6-993ad69e86f6.json +1 -0
- package/node_modules/winston-transport/.nyc_output/processinfo/index.json +1 -1
- package/node_modules/winston-transport/CHANGELOG.md +11 -0
- package/node_modules/winston-transport/dist/index.js +2 -2
- package/node_modules/winston-transport/index.d.ts +2 -0
- package/node_modules/winston-transport/index.js +2 -2
- package/node_modules/winston-transport/node_modules/readable-stream/README.md +106 -0
- package/node_modules/winston-transport/node_modules/readable-stream/errors-browser.js +127 -0
- package/node_modules/winston-transport/node_modules/readable-stream/errors.js +116 -0
- package/node_modules/winston-transport/node_modules/readable-stream/experimentalWarning.js +17 -0
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_duplex.js +41 -46
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_passthrough.js +1 -11
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_readable.js +271 -263
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_transform.js +18 -42
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/_stream_writable.js +101 -147
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/async_iterator.js +180 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/buffer_list.js +183 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/destroy.js +96 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +86 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from-browser.js +3 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/from.js +52 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/pipeline.js +86 -0
- package/node_modules/winston-transport/node_modules/readable-stream/lib/internal/streams/state.js +22 -0
- package/node_modules/winston-transport/node_modules/readable-stream/package.json +72 -0
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable-browser.js +2 -0
- package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/readable.js +5 -8
- package/node_modules/winston-transport/package.json +16 -14
- package/package.json +7 -7
- package/node_modules/colors/LICENSE +0 -25
- package/node_modules/colors/README.md +0 -221
- package/node_modules/colors/examples/normal-usage.js +0 -82
- package/node_modules/colors/examples/safe-string.js +0 -79
- package/node_modules/colors/index.d.ts +0 -136
- package/node_modules/colors/lib/colors.js +0 -211
- package/node_modules/colors/lib/custom/trap.js +0 -46
- package/node_modules/colors/lib/custom/zalgo.js +0 -110
- package/node_modules/colors/lib/extendStringPrototype.js +0 -110
- package/node_modules/colors/lib/index.js +0 -13
- package/node_modules/colors/lib/maps/america.js +0 -10
- package/node_modules/colors/lib/maps/rainbow.js +0 -12
- package/node_modules/colors/lib/maps/random.js +0 -11
- package/node_modules/colors/lib/maps/zebra.js +0 -5
- package/node_modules/colors/lib/styles.js +0 -95
- package/node_modules/colors/lib/system/has-flag.js +0 -35
- package/node_modules/colors/lib/system/supports-colors.js +0 -151
- package/node_modules/colors/package.json +0 -49
- package/node_modules/colors/safe.d.ts +0 -48
- package/node_modules/colors/safe.js +0 -10
- package/node_modules/colors/themes/generic-logging.js +0 -12
- package/node_modules/core-util-is/LICENSE +0 -19
- package/node_modules/core-util-is/README.md +0 -3
- package/node_modules/core-util-is/float.patch +0 -604
- package/node_modules/core-util-is/lib/util.js +0 -107
- package/node_modules/core-util-is/package.json +0 -36
- package/node_modules/core-util-is/test.js +0 -68
- package/node_modules/cycle/README.md +0 -49
- package/node_modules/cycle/cycle.js +0 -170
- package/node_modules/cycle/package.json +0 -16
- package/node_modules/fast-safe-stringify/.travis.yml +0 -8
- package/node_modules/fast-safe-stringify/CHANGELOG.md +0 -17
- package/node_modules/fast-safe-stringify/LICENSE +0 -23
- package/node_modules/fast-safe-stringify/benchmark.js +0 -137
- package/node_modules/fast-safe-stringify/index.d.ts +0 -8
- package/node_modules/fast-safe-stringify/index.js +0 -161
- package/node_modules/fast-safe-stringify/package.json +0 -50
- package/node_modules/fast-safe-stringify/readme.md +0 -154
- package/node_modules/fast-safe-stringify/test-stable.js +0 -311
- package/node_modules/fast-safe-stringify/test.js +0 -304
- package/node_modules/isarray/.npmignore +0 -1
- package/node_modules/isarray/.travis.yml +0 -4
- package/node_modules/isarray/Makefile +0 -6
- package/node_modules/isarray/README.md +0 -60
- package/node_modules/isarray/component.json +0 -19
- package/node_modules/isarray/index.js +0 -5
- package/node_modules/isarray/package.json +0 -49
- package/node_modules/isarray/test.js +0 -20
- package/node_modules/object-hash/.jshintrc +0 -19
- package/node_modules/object-hash/.travis.yml +0 -35
- package/node_modules/object-hash/bower.json +0 -15
- package/node_modules/object-hash/dist/object_hash.js.map +0 -1
- package/node_modules/object-hash/dist/object_hash_test.js +0 -4737
- package/node_modules/object-hash/gulpfile.js +0 -97
- package/node_modules/object-hash/karma.conf.js +0 -69
- package/node_modules/object-hash/test/blob.js +0 -41
- package/node_modules/object-hash/test/index.js +0 -290
- package/node_modules/object-hash/test/object-classes.js +0 -106
- package/node_modules/object-hash/test/old-crypto.js +0 -60
- package/node_modules/object-hash/test/replacer.js +0 -36
- package/node_modules/object-hash/test/types.js +0 -174
- package/node_modules/object-hash/test/writeToStream.js +0 -27
- package/node_modules/process-nextick-args/index.js +0 -45
- package/node_modules/process-nextick-args/license.md +0 -19
- package/node_modules/process-nextick-args/package.json +0 -29
- package/node_modules/process-nextick-args/readme.md +0 -18
- package/node_modules/readable-stream/.travis.yml +0 -34
- package/node_modules/readable-stream/README.md +0 -58
- package/node_modules/readable-stream/doc/wg-meetings/2015-01-30.md +0 -60
- package/node_modules/readable-stream/duplex-browser.js +0 -1
- package/node_modules/readable-stream/duplex.js +0 -1
- package/node_modules/readable-stream/lib/internal/streams/BufferList.js +0 -79
- package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -74
- package/node_modules/readable-stream/package.json +0 -56
- package/node_modules/readable-stream/passthrough.js +0 -1
- package/node_modules/readable-stream/transform.js +0 -1
- package/node_modules/readable-stream/writable-browser.js +0 -1
- package/node_modules/readable-stream/writable.js +0 -8
- package/node_modules/winston-compat/.gitattributes +0 -1
- package/node_modules/winston-compat/.node-version +0 -1
- package/node_modules/winston-compat/CHANGELOG.md +0 -17
- package/node_modules/winston-compat/LICENSE +0 -22
- package/node_modules/winston-compat/README.md +0 -2
- package/node_modules/winston-compat/index.js +0 -295
- package/node_modules/winston-compat/lib/transport.js +0 -135
- package/node_modules/winston-compat/node_modules/fecha/CHANGELOG.md +0 -11
- package/node_modules/winston-compat/node_modules/fecha/LICENSE +0 -22
- package/node_modules/winston-compat/node_modules/fecha/README.md +0 -259
- package/node_modules/winston-compat/node_modules/fecha/fecha.d.ts +0 -47
- package/node_modules/winston-compat/node_modules/fecha/fecha.js +0 -334
- package/node_modules/winston-compat/node_modules/fecha/fecha.min.js +0 -1
- package/node_modules/winston-compat/node_modules/fecha/package.json +0 -44
- package/node_modules/winston-compat/node_modules/logform/.babelrc +0 -3
- package/node_modules/winston-compat/node_modules/logform/.eslintrc +0 -7
- package/node_modules/winston-compat/node_modules/logform/.gitattributes +0 -1
- package/node_modules/winston-compat/node_modules/logform/.travis.yml +0 -17
- package/node_modules/winston-compat/node_modules/logform/CHANGELOG.md +0 -103
- package/node_modules/winston-compat/node_modules/logform/LICENSE +0 -21
- package/node_modules/winston-compat/node_modules/logform/README.md +0 -170
- package/node_modules/winston-compat/node_modules/logform/align.js +0 -14
- package/node_modules/winston-compat/node_modules/logform/browser.js +0 -36
- package/node_modules/winston-compat/node_modules/logform/cli.js +0 -52
- package/node_modules/winston-compat/node_modules/logform/colorize.js +0 -118
- package/node_modules/winston-compat/node_modules/logform/combine.js +0 -66
- package/node_modules/winston-compat/node_modules/logform/dist/align.js +0 -14
- package/node_modules/winston-compat/node_modules/logform/dist/browser.js +0 -37
- package/node_modules/winston-compat/node_modules/logform/dist/cli.js +0 -75
- package/node_modules/winston-compat/node_modules/logform/dist/colorize.js +0 -147
- package/node_modules/winston-compat/node_modules/logform/dist/combine.js +0 -66
- package/node_modules/winston-compat/node_modules/logform/dist/format.js +0 -69
- package/node_modules/winston-compat/node_modules/logform/dist/index.js +0 -54
- package/node_modules/winston-compat/node_modules/logform/dist/json.js +0 -27
- package/node_modules/winston-compat/node_modules/logform/dist/label.js +0 -19
- package/node_modules/winston-compat/node_modules/logform/dist/levels.js +0 -15
- package/node_modules/winston-compat/node_modules/logform/dist/logstash.js +0 -32
- package/node_modules/winston-compat/node_modules/logform/dist/metadata.js +0 -63
- package/node_modules/winston-compat/node_modules/logform/dist/ms.js +0 -18
- package/node_modules/winston-compat/node_modules/logform/dist/pad-levels.js +0 -118
- package/node_modules/winston-compat/node_modules/logform/dist/pretty-print.js +0 -20
- package/node_modules/winston-compat/node_modules/logform/dist/printf.js +0 -40
- package/node_modules/winston-compat/node_modules/logform/dist/simple.js +0 -36
- package/node_modules/winston-compat/node_modules/logform/dist/splat.js +0 -147
- package/node_modules/winston-compat/node_modules/logform/dist/timestamp.js +0 -28
- package/node_modules/winston-compat/node_modules/logform/dist/uncolorize.js +0 -31
- package/node_modules/winston-compat/node_modules/logform/examples/combine.js +0 -14
- package/node_modules/winston-compat/node_modules/logform/examples/filter.js +0 -30
- package/node_modules/winston-compat/node_modules/logform/examples/invalid.js +0 -6
- package/node_modules/winston-compat/node_modules/logform/examples/metadata.js +0 -78
- package/node_modules/winston-compat/node_modules/logform/examples/padLevels.js +0 -39
- package/node_modules/winston-compat/node_modules/logform/examples/volume.js +0 -25
- package/node_modules/winston-compat/node_modules/logform/format.js +0 -52
- package/node_modules/winston-compat/node_modules/logform/index.d.ts +0 -53
- package/node_modules/winston-compat/node_modules/logform/index.js +0 -52
- package/node_modules/winston-compat/node_modules/logform/json.js +0 -26
- package/node_modules/winston-compat/node_modules/logform/label.js +0 -19
- package/node_modules/winston-compat/node_modules/logform/levels.js +0 -12
- package/node_modules/winston-compat/node_modules/logform/logstash.js +0 -29
- package/node_modules/winston-compat/node_modules/logform/metadata.js +0 -61
- package/node_modules/winston-compat/node_modules/logform/ms.js +0 -18
- package/node_modules/winston-compat/node_modules/logform/package.json +0 -51
- package/node_modules/winston-compat/node_modules/logform/pad-levels.js +0 -83
- package/node_modules/winston-compat/node_modules/logform/pretty-print.js +0 -16
- package/node_modules/winston-compat/node_modules/logform/printf.js +0 -26
- package/node_modules/winston-compat/node_modules/logform/simple.js +0 -33
- package/node_modules/winston-compat/node_modules/logform/splat.js +0 -125
- package/node_modules/winston-compat/node_modules/logform/timestamp.js +0 -30
- package/node_modules/winston-compat/node_modules/logform/tsconfig.json +0 -22
- package/node_modules/winston-compat/node_modules/logform/uncolorize.js +0 -27
- package/node_modules/winston-compat/package.json +0 -46
- package/node_modules/winston-compat/test/clone.test.js +0 -25
- package/node_modules/winston-compat/test/helpers.js +0 -256
- package/node_modules/winston-compat/test/timestamp.test.js +0 -14
- package/node_modules/winston-compat/test/transports/transport.js +0 -205
- package/node_modules/winston-compat/test/winston-compat.test.js +0 -18
- package/node_modules/winston-daily-rotate-file/.eslintrc.js +0 -11
- package/node_modules/winston-daily-rotate-file/.node-version +0 -1
- package/node_modules/winston-daily-rotate-file/.travis.yml +0 -15
- package/node_modules/winston-daily-rotate-file/node_modules/semver/CHANGELOG.md +0 -70
- package/node_modules/winston-daily-rotate-file/node_modules/semver/LICENSE +0 -15
- package/node_modules/winston-daily-rotate-file/node_modules/semver/README.md +0 -443
- package/node_modules/winston-daily-rotate-file/node_modules/semver/bin/semver.js +0 -174
- package/node_modules/winston-daily-rotate-file/node_modules/semver/package.json +0 -32
- package/node_modules/winston-daily-rotate-file/node_modules/semver/range.bnf +0 -16
- package/node_modules/winston-daily-rotate-file/node_modules/semver/semver.js +0 -1596
- package/node_modules/winston-daily-rotate-file/test/memory-stream.js +0 -38
- package/node_modules/winston-daily-rotate-file/test/random-string.js +0 -31
- package/node_modules/winston-daily-rotate-file/test/transport-tests.js +0 -250
- package/node_modules/winston-transport/.nyc_output/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
- package/node_modules/winston-transport/.nyc_output/processinfo/1c69f3e4-4c25-457d-9df5-dfa761729528.json +0 -1
- package/node_modules/winston-transport/.travis.yml +0 -17
- package/node_modules/winston-transport/tsconfig.json +0 -22
- /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/CONTRIBUTING.md +0 -0
- /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/GOVERNANCE.md +0 -0
- /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/LICENSE +0 -0
- /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream-browser.js +0 -0
- /package/node_modules/{readable-stream → winston-transport/node_modules/readable-stream}/lib/internal/streams/stream.js +0 -0
|
@@ -1,174 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var assert = require('assert');
|
|
4
|
-
var crypto = require('crypto');
|
|
5
|
-
var hash = require('../index');
|
|
6
|
-
var validSha1 = /^[0-9a-f]{40}$/i;
|
|
7
|
-
|
|
8
|
-
describe('hash()ing different types', function() {
|
|
9
|
-
it('hashes non-object types', function() {
|
|
10
|
-
var func = function(a){ return a + 1; };
|
|
11
|
-
assert.ok(validSha1.test(hash('Shazbot!')), 'hash string');
|
|
12
|
-
assert.ok(validSha1.test(hash(42)), 'hash number');
|
|
13
|
-
assert.ok(validSha1.test(hash(NaN)), 'hash bool');
|
|
14
|
-
assert.ok(validSha1.test(hash(true)), 'hash bool');
|
|
15
|
-
assert.ok(validSha1.test(hash(func)), 'hash function');
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('hashes special object types', function() {
|
|
19
|
-
var dt = new Date();
|
|
20
|
-
dt.setDate(dt.getDate() + 1);
|
|
21
|
-
|
|
22
|
-
assert.ok(validSha1.test(hash([1,2,3,4])), 'hash array');
|
|
23
|
-
assert.notEqual(hash([1,2,3,4]), hash([4,3,2,1]), 'different arrays not equal');
|
|
24
|
-
assert.ok(validSha1.test(hash(new Date())), 'hash date');
|
|
25
|
-
assert.notEqual(hash(new Date()), hash(dt), 'different dates not equal');
|
|
26
|
-
assert.ok(validSha1.test(hash(null)), 'hash Null');
|
|
27
|
-
assert.ok(validSha1.test(hash(Number.NaN)), 'hash NaN');
|
|
28
|
-
assert.ok(validSha1.test(hash({ foo: undefined })), 'hash Undefined value');
|
|
29
|
-
assert.ok(validSha1.test(hash(new RegExp())), 'hash regex');
|
|
30
|
-
assert.ok(validSha1.test(hash(new Error())), 'hash error');
|
|
31
|
-
});
|
|
32
|
-
|
|
33
|
-
it('hashes node.js-internal object types', function() {
|
|
34
|
-
if (typeof process !== 'undefined') {
|
|
35
|
-
assert.ok(validSha1.test(hash(process)), 'hash process');
|
|
36
|
-
}
|
|
37
|
-
|
|
38
|
-
var timer = setTimeout(function() {}, 0);
|
|
39
|
-
assert.ok(validSha1.test(hash(timer)), 'hash timer');
|
|
40
|
-
});
|
|
41
|
-
|
|
42
|
-
if (typeof Symbol !== 'undefined') {
|
|
43
|
-
it('hashes Symbols', function() {
|
|
44
|
-
assert.ok(validSha1.test(hash(Symbol('Banana'))), 'hash error');
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
|
|
48
|
-
if (typeof Buffer !== 'undefined') {
|
|
49
|
-
it("Buffers can be hashed", function() {
|
|
50
|
-
assert.ok(validSha1.test(hash(new Buffer('Banana'))), 'hashes Buffers');
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
if (typeof Uint8Array !== 'undefined') {
|
|
55
|
-
it("Typed arrays can be hashed", function() {
|
|
56
|
-
|
|
57
|
-
assert.ok(validSha1.test(hash(new Uint8Array([1,2,3,4]))), 'hashes Uint8Array');
|
|
58
|
-
assert.ok(validSha1.test(hash(new Int8Array([1,2,3,4]))), 'hashes Int8Array');
|
|
59
|
-
assert.ok(validSha1.test(hash(new Uint16Array([1,2,3,4]))), 'hashes Uint16Array');
|
|
60
|
-
assert.ok(validSha1.test(hash(new Int16Array([1,2,3,4]))), 'hashes Int16Array');
|
|
61
|
-
assert.ok(validSha1.test(hash(new Uint32Array([1,2,3,4]))), 'hashes Uint32Array');
|
|
62
|
-
assert.ok(validSha1.test(hash(new Int32Array([1,2,3,4]))), 'hashes Int32Array');
|
|
63
|
-
assert.ok(validSha1.test(hash(new Float32Array([1,2,3,4]))), 'hashes Float32Array');
|
|
64
|
-
if (typeof Float64Array !== 'undefined')
|
|
65
|
-
assert.ok(validSha1.test(hash(new Float64Array([1,2,3,4]))), 'hashes Float64Array');
|
|
66
|
-
if (typeof Uint8ClampedArray !== 'undefined')
|
|
67
|
-
assert.ok(validSha1.test(hash(new Uint8ClampedArray([1,2,3,4]))), 'hashes Uint8ClampedArray');
|
|
68
|
-
assert.ok(validSha1.test(hash(new Uint8Array([1,2,3,4]).buffer)), 'hashes ArrayBuffer');
|
|
69
|
-
});
|
|
70
|
-
}
|
|
71
|
-
|
|
72
|
-
if (typeof Map !== 'undefined') {
|
|
73
|
-
it("Maps can be hashed", function() {
|
|
74
|
-
var map = new Map([['a',1],['b',2]]);
|
|
75
|
-
assert.ok(validSha1.test(hash(map)), 'hashes Maps');
|
|
76
|
-
});
|
|
77
|
-
}
|
|
78
|
-
|
|
79
|
-
if (typeof WeakMap !== 'undefined') {
|
|
80
|
-
it("WeakMaps can’t be hashed", function() {
|
|
81
|
-
var map = new WeakMap([[{foo: 'bar'},1]]);
|
|
82
|
-
assert.throws(function() {
|
|
83
|
-
validSha1.test(hash(map))
|
|
84
|
-
}, 'does not hash WeakMaps');
|
|
85
|
-
});
|
|
86
|
-
}
|
|
87
|
-
|
|
88
|
-
if (typeof Set !== 'undefined') {
|
|
89
|
-
it("Sets can be hashed", function() {
|
|
90
|
-
var set = new Set(['you', 'du', 'tu', 'あなた', '您']);
|
|
91
|
-
assert.ok(validSha1.test(hash(set)), 'hashes Sets');
|
|
92
|
-
});
|
|
93
|
-
}
|
|
94
|
-
|
|
95
|
-
if (typeof WeakSet !== 'undefined') {
|
|
96
|
-
it("WeakSets can’t be hashed", function() {
|
|
97
|
-
var obj = {foo: 'bar'};
|
|
98
|
-
var set = new WeakSet([obj]);
|
|
99
|
-
assert.throws(function() {
|
|
100
|
-
validSha1.test(hash(set))
|
|
101
|
-
}, 'does not hash WeakSets');
|
|
102
|
-
});
|
|
103
|
-
}
|
|
104
|
-
|
|
105
|
-
it("Builtin types themselves can be hashed", function() {
|
|
106
|
-
var hashcount = {};
|
|
107
|
-
var types = [Object, Date, Number, String, Function, RegExp,
|
|
108
|
-
Error, 0, null, NaN];
|
|
109
|
-
if (typeof WeakSet !== 'undefined') types.push(WeakSet);
|
|
110
|
-
if (typeof Set !== 'undefined') types.push(Set);
|
|
111
|
-
if (typeof WeakMap !== 'undefined') types.push(WeakMap);
|
|
112
|
-
if (typeof Map !== 'undefined') types.push(Map);
|
|
113
|
-
if (typeof Symbol !== 'undefined') types.push(Symbol);
|
|
114
|
-
if (typeof Uint8Array !== 'undefined') types.push(Uint8Array);
|
|
115
|
-
|
|
116
|
-
// Hash each type
|
|
117
|
-
for (var idx in types) {
|
|
118
|
-
var h = hash(types[idx]);
|
|
119
|
-
assert.ok(validSha1.test(h));
|
|
120
|
-
hashcount[h] = (hashcount[h] || 0) + 1;
|
|
121
|
-
}
|
|
122
|
-
|
|
123
|
-
// Check for collisions
|
|
124
|
-
var no = 0;
|
|
125
|
-
for (var h in hashcount) {
|
|
126
|
-
assert.equal(hashcount[h], 1);
|
|
127
|
-
no++;
|
|
128
|
-
}
|
|
129
|
-
|
|
130
|
-
// Self check; did we really hash all the types?
|
|
131
|
-
assert.equal(no, types.length);
|
|
132
|
-
});
|
|
133
|
-
|
|
134
|
-
it("Builtin types might result in identical hashes with respectFunctionNames = false", function() {
|
|
135
|
-
var hashcount = {};
|
|
136
|
-
var types = [Object, Date, Number, String, Function, RegExp,
|
|
137
|
-
Error, 0, null, NaN];
|
|
138
|
-
if (typeof WeakSet !== 'undefined') types.push(WeakSet);
|
|
139
|
-
if (typeof Set !== 'undefined') types.push(Set);
|
|
140
|
-
if (typeof WeakMap !== 'undefined') types.push(WeakMap);
|
|
141
|
-
if (typeof Map !== 'undefined') types.push(Map);
|
|
142
|
-
if (typeof Symbol !== 'undefined') types.push(Symbol);
|
|
143
|
-
if (typeof Uint8Array !== 'undefined') types.push(Uint8Array);
|
|
144
|
-
|
|
145
|
-
// Hash each type
|
|
146
|
-
for (var idx in types) {
|
|
147
|
-
var h = hash(types[idx], { respectFunctionNames: false });
|
|
148
|
-
assert.ok(validSha1.test(h));
|
|
149
|
-
hashcount[h] = (hashcount[h] || 0) + 1;
|
|
150
|
-
}
|
|
151
|
-
|
|
152
|
-
// Check for collisions
|
|
153
|
-
var no = 0;
|
|
154
|
-
for (var h in hashcount) {
|
|
155
|
-
assert.ok(hashcount[h] >= 1);
|
|
156
|
-
no += hashcount[h];
|
|
157
|
-
}
|
|
158
|
-
|
|
159
|
-
// Self check; did we really hash all the types?
|
|
160
|
-
assert.equal(no, types.length);
|
|
161
|
-
});
|
|
162
|
-
|
|
163
|
-
it("Functions with identical bodies and different names result in identical hashes with respectFunctionNames = false", function() {
|
|
164
|
-
var fn1 = function a() {};
|
|
165
|
-
var fn2 = function b() {};
|
|
166
|
-
var toStringDummy = function() { return '...'; };
|
|
167
|
-
fn1.toString = toStringDummy;
|
|
168
|
-
fn2.toString = toStringDummy;
|
|
169
|
-
|
|
170
|
-
var h1 = hash(fn1, { respectFunctionNames: false });
|
|
171
|
-
var h2 = hash(fn2, { respectFunctionNames: false });
|
|
172
|
-
assert.strictEqual(h1, h2);
|
|
173
|
-
});
|
|
174
|
-
});
|
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
var assert = require('assert');
|
|
4
|
-
var stream = require('stream');
|
|
5
|
-
var hash = require('../index');
|
|
6
|
-
|
|
7
|
-
describe('writeToStream', function() {
|
|
8
|
-
it('should emit information about an object to a stream', function() {
|
|
9
|
-
var strm = new stream.PassThrough();
|
|
10
|
-
|
|
11
|
-
hash.writeToStream({foo: 'bar'}, strm);
|
|
12
|
-
var result = strm.read().toString();
|
|
13
|
-
assert.strictEqual(typeof result, 'string');
|
|
14
|
-
assert.notStrictEqual(result.indexOf('foo'), -1);
|
|
15
|
-
assert.notStrictEqual(result.indexOf('bar'), -1);
|
|
16
|
-
});
|
|
17
|
-
|
|
18
|
-
it('should leave out keys when excludeValues = true', function() {
|
|
19
|
-
var strm = new stream.PassThrough();
|
|
20
|
-
|
|
21
|
-
hash.writeToStream({foo: 'bar'}, {excludeValues: true}, strm);
|
|
22
|
-
var result = strm.read().toString();
|
|
23
|
-
assert.strictEqual(typeof result, 'string');
|
|
24
|
-
assert.notStrictEqual(result.indexOf('foo'), -1);
|
|
25
|
-
assert. strictEqual(result.indexOf('bar'), -1);
|
|
26
|
-
});
|
|
27
|
-
});
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
if (typeof process === 'undefined' ||
|
|
4
|
-
!process.version ||
|
|
5
|
-
process.version.indexOf('v0.') === 0 ||
|
|
6
|
-
process.version.indexOf('v1.') === 0 && process.version.indexOf('v1.8.') !== 0) {
|
|
7
|
-
module.exports = { nextTick: nextTick };
|
|
8
|
-
} else {
|
|
9
|
-
module.exports = process
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
function nextTick(fn, arg1, arg2, arg3) {
|
|
13
|
-
if (typeof fn !== 'function') {
|
|
14
|
-
throw new TypeError('"callback" argument must be a function');
|
|
15
|
-
}
|
|
16
|
-
var len = arguments.length;
|
|
17
|
-
var args, i;
|
|
18
|
-
switch (len) {
|
|
19
|
-
case 0:
|
|
20
|
-
case 1:
|
|
21
|
-
return process.nextTick(fn);
|
|
22
|
-
case 2:
|
|
23
|
-
return process.nextTick(function afterTickOne() {
|
|
24
|
-
fn.call(null, arg1);
|
|
25
|
-
});
|
|
26
|
-
case 3:
|
|
27
|
-
return process.nextTick(function afterTickTwo() {
|
|
28
|
-
fn.call(null, arg1, arg2);
|
|
29
|
-
});
|
|
30
|
-
case 4:
|
|
31
|
-
return process.nextTick(function afterTickThree() {
|
|
32
|
-
fn.call(null, arg1, arg2, arg3);
|
|
33
|
-
});
|
|
34
|
-
default:
|
|
35
|
-
args = new Array(len - 1);
|
|
36
|
-
i = 0;
|
|
37
|
-
while (i < args.length) {
|
|
38
|
-
args[i++] = arguments[i];
|
|
39
|
-
}
|
|
40
|
-
return process.nextTick(function afterTick() {
|
|
41
|
-
fn.apply(null, args);
|
|
42
|
-
});
|
|
43
|
-
}
|
|
44
|
-
}
|
|
45
|
-
|
|
@@ -1,19 +0,0 @@
|
|
|
1
|
-
# Copyright (c) 2015 Calvin Metcalf
|
|
2
|
-
|
|
3
|
-
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
4
|
-
of this software and associated documentation files (the "Software"), to deal
|
|
5
|
-
in the Software without restriction, including without limitation the rights
|
|
6
|
-
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
7
|
-
copies of the Software, and to permit persons to whom the Software is
|
|
8
|
-
furnished to do so, subject to the following conditions:
|
|
9
|
-
|
|
10
|
-
The above copyright notice and this permission notice shall be included in all
|
|
11
|
-
copies or substantial portions of the Software.
|
|
12
|
-
|
|
13
|
-
**THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
14
|
-
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
15
|
-
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
16
|
-
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
17
|
-
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
18
|
-
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
19
|
-
SOFTWARE.**
|
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"name": "process-nextick-args",
|
|
3
|
-
"version": "2.0.1",
|
|
4
|
-
"description": "process.nextTick but always with args",
|
|
5
|
-
"main": "index.js",
|
|
6
|
-
"files": [
|
|
7
|
-
"index.js"
|
|
8
|
-
],
|
|
9
|
-
"scripts": {
|
|
10
|
-
"test": "node test.js"
|
|
11
|
-
},
|
|
12
|
-
"repository": {
|
|
13
|
-
"type": "git",
|
|
14
|
-
"url": "https://github.com/calvinmetcalf/process-nextick-args.git"
|
|
15
|
-
},
|
|
16
|
-
"author": "",
|
|
17
|
-
"license": "MIT",
|
|
18
|
-
"bugs": {
|
|
19
|
-
"url": "https://github.com/calvinmetcalf/process-nextick-args/issues"
|
|
20
|
-
},
|
|
21
|
-
"homepage": "https://github.com/calvinmetcalf/process-nextick-args",
|
|
22
|
-
"devDependencies": {
|
|
23
|
-
"tap": "~0.2.6"
|
|
24
|
-
}
|
|
25
|
-
|
|
26
|
-
,"_resolved": "https://registry.npmjs.org/process-nextick-args/-/process-nextick-args-2.0.1.tgz"
|
|
27
|
-
,"_integrity": "sha512-3ouUOpQhtgrbOa17J7+uxOTpITYWaGP7/AhoR3+A+/1e9skrzelGi/dXzEYyvbxubEF6Wn2ypscTKiKJFFn1ag=="
|
|
28
|
-
,"_from": "process-nextick-args@2.0.1"
|
|
29
|
-
}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
process-nextick-args
|
|
2
|
-
=====
|
|
3
|
-
|
|
4
|
-
[](https://travis-ci.org/calvinmetcalf/process-nextick-args)
|
|
5
|
-
|
|
6
|
-
```bash
|
|
7
|
-
npm install --save process-nextick-args
|
|
8
|
-
```
|
|
9
|
-
|
|
10
|
-
Always be able to pass arguments to process.nextTick, no matter the platform
|
|
11
|
-
|
|
12
|
-
```js
|
|
13
|
-
var pna = require('process-nextick-args');
|
|
14
|
-
|
|
15
|
-
pna.nextTick(function (a, b, c) {
|
|
16
|
-
console.log(a, b, c);
|
|
17
|
-
}, 'step', 3, 'profit');
|
|
18
|
-
```
|
|
@@ -1,34 +0,0 @@
|
|
|
1
|
-
sudo: false
|
|
2
|
-
language: node_js
|
|
3
|
-
before_install:
|
|
4
|
-
- (test $NPM_LEGACY && npm install -g npm@2 && npm install -g npm@3) || true
|
|
5
|
-
notifications:
|
|
6
|
-
email: false
|
|
7
|
-
matrix:
|
|
8
|
-
fast_finish: true
|
|
9
|
-
include:
|
|
10
|
-
- node_js: '0.8'
|
|
11
|
-
env: NPM_LEGACY=true
|
|
12
|
-
- node_js: '0.10'
|
|
13
|
-
env: NPM_LEGACY=true
|
|
14
|
-
- node_js: '0.11'
|
|
15
|
-
env: NPM_LEGACY=true
|
|
16
|
-
- node_js: '0.12'
|
|
17
|
-
env: NPM_LEGACY=true
|
|
18
|
-
- node_js: 1
|
|
19
|
-
env: NPM_LEGACY=true
|
|
20
|
-
- node_js: 2
|
|
21
|
-
env: NPM_LEGACY=true
|
|
22
|
-
- node_js: 3
|
|
23
|
-
env: NPM_LEGACY=true
|
|
24
|
-
- node_js: 4
|
|
25
|
-
- node_js: 5
|
|
26
|
-
- node_js: 6
|
|
27
|
-
- node_js: 7
|
|
28
|
-
- node_js: 8
|
|
29
|
-
- node_js: 9
|
|
30
|
-
script: "npm run test"
|
|
31
|
-
env:
|
|
32
|
-
global:
|
|
33
|
-
- secure: rE2Vvo7vnjabYNULNyLFxOyt98BoJexDqsiOnfiD6kLYYsiQGfr/sbZkPMOFm9qfQG7pjqx+zZWZjGSswhTt+626C0t/njXqug7Yps4c3dFblzGfreQHp7wNX5TFsvrxd6dAowVasMp61sJcRnB2w8cUzoe3RAYUDHyiHktwqMc=
|
|
34
|
-
- secure: g9YINaKAdMatsJ28G9jCGbSaguXCyxSTy+pBO6Ch0Cf57ZLOTka3HqDj8p3nV28LUIHZ3ut5WO43CeYKwt4AUtLpBS3a0dndHdY6D83uY6b2qh5hXlrcbeQTq2cvw2y95F7hm4D1kwrgZ7ViqaKggRcEupAL69YbJnxeUDKWEdI=
|
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
# readable-stream
|
|
2
|
-
|
|
3
|
-
***Node-core v8.11.1 streams for userland*** [](https://travis-ci.org/nodejs/readable-stream)
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
[](https://nodei.co/npm/readable-stream/)
|
|
7
|
-
[](https://nodei.co/npm/readable-stream/)
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
[](https://saucelabs.com/u/readable-stream)
|
|
11
|
-
|
|
12
|
-
```bash
|
|
13
|
-
npm install --save readable-stream
|
|
14
|
-
```
|
|
15
|
-
|
|
16
|
-
***Node-core streams for userland***
|
|
17
|
-
|
|
18
|
-
This package is a mirror of the Streams2 and Streams3 implementations in
|
|
19
|
-
Node-core.
|
|
20
|
-
|
|
21
|
-
Full documentation may be found on the [Node.js website](https://nodejs.org/dist/v8.11.1/docs/api/stream.html).
|
|
22
|
-
|
|
23
|
-
If you want to guarantee a stable streams base, regardless of what version of
|
|
24
|
-
Node you, or the users of your libraries are using, use **readable-stream** *only* and avoid the *"stream"* module in Node-core, for background see [this blogpost](http://r.va.gg/2014/06/why-i-dont-use-nodes-core-stream-module.html).
|
|
25
|
-
|
|
26
|
-
As of version 2.0.0 **readable-stream** uses semantic versioning.
|
|
27
|
-
|
|
28
|
-
# Streams Working Group
|
|
29
|
-
|
|
30
|
-
`readable-stream` is maintained by the Streams Working Group, which
|
|
31
|
-
oversees the development and maintenance of the Streams API within
|
|
32
|
-
Node.js. The responsibilities of the Streams Working Group include:
|
|
33
|
-
|
|
34
|
-
* Addressing stream issues on the Node.js issue tracker.
|
|
35
|
-
* Authoring and editing stream documentation within the Node.js project.
|
|
36
|
-
* Reviewing changes to stream subclasses within the Node.js project.
|
|
37
|
-
* Redirecting changes to streams from the Node.js project to this
|
|
38
|
-
project.
|
|
39
|
-
* Assisting in the implementation of stream providers within Node.js.
|
|
40
|
-
* Recommending versions of `readable-stream` to be included in Node.js.
|
|
41
|
-
* Messaging about the future of streams to give the community advance
|
|
42
|
-
notice of changes.
|
|
43
|
-
|
|
44
|
-
<a name="members"></a>
|
|
45
|
-
## Team Members
|
|
46
|
-
|
|
47
|
-
* **Chris Dickinson** ([@chrisdickinson](https://github.com/chrisdickinson)) <christopher.s.dickinson@gmail.com>
|
|
48
|
-
- Release GPG key: 9554F04D7259F04124DE6B476D5A82AC7E37093B
|
|
49
|
-
* **Calvin Metcalf** ([@calvinmetcalf](https://github.com/calvinmetcalf)) <calvin.metcalf@gmail.com>
|
|
50
|
-
- Release GPG key: F3EF5F62A87FC27A22E643F714CE4FF5015AA242
|
|
51
|
-
* **Rod Vagg** ([@rvagg](https://github.com/rvagg)) <rod@vagg.org>
|
|
52
|
-
- Release GPG key: DD8F2338BAE7501E3DD5AC78C273792F7D83545D
|
|
53
|
-
* **Sam Newman** ([@sonewman](https://github.com/sonewman)) <newmansam@outlook.com>
|
|
54
|
-
* **Mathias Buus** ([@mafintosh](https://github.com/mafintosh)) <mathiasbuus@gmail.com>
|
|
55
|
-
* **Domenic Denicola** ([@domenic](https://github.com/domenic)) <d@domenic.me>
|
|
56
|
-
* **Matteo Collina** ([@mcollina](https://github.com/mcollina)) <matteo.collina@gmail.com>
|
|
57
|
-
- Release GPG key: 3ABC01543F22DD2239285CDD818674489FBC127E
|
|
58
|
-
* **Irina Shestak** ([@lrlna](https://github.com/lrlna)) <shestak.irina@gmail.com>
|
|
@@ -1,60 +0,0 @@
|
|
|
1
|
-
# streams WG Meeting 2015-01-30
|
|
2
|
-
|
|
3
|
-
## Links
|
|
4
|
-
|
|
5
|
-
* **Google Hangouts Video**: http://www.youtube.com/watch?v=I9nDOSGfwZg
|
|
6
|
-
* **GitHub Issue**: https://github.com/iojs/readable-stream/issues/106
|
|
7
|
-
* **Original Minutes Google Doc**: https://docs.google.com/document/d/17aTgLnjMXIrfjgNaTUnHQO7m3xgzHR2VXBTmi03Qii4/
|
|
8
|
-
|
|
9
|
-
## Agenda
|
|
10
|
-
|
|
11
|
-
Extracted from https://github.com/iojs/readable-stream/labels/wg-agenda prior to meeting.
|
|
12
|
-
|
|
13
|
-
* adopt a charter [#105](https://github.com/iojs/readable-stream/issues/105)
|
|
14
|
-
* release and versioning strategy [#101](https://github.com/iojs/readable-stream/issues/101)
|
|
15
|
-
* simpler stream creation [#102](https://github.com/iojs/readable-stream/issues/102)
|
|
16
|
-
* proposal: deprecate implicit flowing of streams [#99](https://github.com/iojs/readable-stream/issues/99)
|
|
17
|
-
|
|
18
|
-
## Minutes
|
|
19
|
-
|
|
20
|
-
### adopt a charter
|
|
21
|
-
|
|
22
|
-
* group: +1's all around
|
|
23
|
-
|
|
24
|
-
### What versioning scheme should be adopted?
|
|
25
|
-
* group: +1’s 3.0.0
|
|
26
|
-
* domenic+group: pulling in patches from other sources where appropriate
|
|
27
|
-
* mikeal: version independently, suggesting versions for io.js
|
|
28
|
-
* mikeal+domenic: work with TC to notify in advance of changes
|
|
29
|
-
simpler stream creation
|
|
30
|
-
|
|
31
|
-
### streamline creation of streams
|
|
32
|
-
* sam: streamline creation of streams
|
|
33
|
-
* domenic: nice simple solution posted
|
|
34
|
-
but, we lose the opportunity to change the model
|
|
35
|
-
may not be backwards incompatible (double check keys)
|
|
36
|
-
|
|
37
|
-
**action item:** domenic will check
|
|
38
|
-
|
|
39
|
-
### remove implicit flowing of streams on(‘data’)
|
|
40
|
-
* add isFlowing / isPaused
|
|
41
|
-
* mikeal: worrying that we’re documenting polyfill methods – confuses users
|
|
42
|
-
* domenic: more reflective API is probably good, with warning labels for users
|
|
43
|
-
* new section for mad scientists (reflective stream access)
|
|
44
|
-
* calvin: name the “third state”
|
|
45
|
-
* mikeal: maybe borrow the name from whatwg?
|
|
46
|
-
* domenic: we’re missing the “third state”
|
|
47
|
-
* consensus: kind of difficult to name the third state
|
|
48
|
-
* mikeal: figure out differences in states / compat
|
|
49
|
-
* mathias: always flow on data – eliminates third state
|
|
50
|
-
* explore what it breaks
|
|
51
|
-
|
|
52
|
-
**action items:**
|
|
53
|
-
* ask isaac for ability to list packages by what public io.js APIs they use (esp. Stream)
|
|
54
|
-
* ask rod/build for infrastructure
|
|
55
|
-
* **chris**: explore the “flow on data” approach
|
|
56
|
-
* add isPaused/isFlowing
|
|
57
|
-
* add new docs section
|
|
58
|
-
* move isPaused to that section
|
|
59
|
-
|
|
60
|
-
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./lib/_stream_duplex.js');
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
module.exports = require('./readable').Duplex
|
|
@@ -1,79 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
|
|
4
|
-
|
|
5
|
-
var Buffer = require('safe-buffer').Buffer;
|
|
6
|
-
var util = require('util');
|
|
7
|
-
|
|
8
|
-
function copyBuffer(src, target, offset) {
|
|
9
|
-
src.copy(target, offset);
|
|
10
|
-
}
|
|
11
|
-
|
|
12
|
-
module.exports = function () {
|
|
13
|
-
function BufferList() {
|
|
14
|
-
_classCallCheck(this, BufferList);
|
|
15
|
-
|
|
16
|
-
this.head = null;
|
|
17
|
-
this.tail = null;
|
|
18
|
-
this.length = 0;
|
|
19
|
-
}
|
|
20
|
-
|
|
21
|
-
BufferList.prototype.push = function push(v) {
|
|
22
|
-
var entry = { data: v, next: null };
|
|
23
|
-
if (this.length > 0) this.tail.next = entry;else this.head = entry;
|
|
24
|
-
this.tail = entry;
|
|
25
|
-
++this.length;
|
|
26
|
-
};
|
|
27
|
-
|
|
28
|
-
BufferList.prototype.unshift = function unshift(v) {
|
|
29
|
-
var entry = { data: v, next: this.head };
|
|
30
|
-
if (this.length === 0) this.tail = entry;
|
|
31
|
-
this.head = entry;
|
|
32
|
-
++this.length;
|
|
33
|
-
};
|
|
34
|
-
|
|
35
|
-
BufferList.prototype.shift = function shift() {
|
|
36
|
-
if (this.length === 0) return;
|
|
37
|
-
var ret = this.head.data;
|
|
38
|
-
if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
|
|
39
|
-
--this.length;
|
|
40
|
-
return ret;
|
|
41
|
-
};
|
|
42
|
-
|
|
43
|
-
BufferList.prototype.clear = function clear() {
|
|
44
|
-
this.head = this.tail = null;
|
|
45
|
-
this.length = 0;
|
|
46
|
-
};
|
|
47
|
-
|
|
48
|
-
BufferList.prototype.join = function join(s) {
|
|
49
|
-
if (this.length === 0) return '';
|
|
50
|
-
var p = this.head;
|
|
51
|
-
var ret = '' + p.data;
|
|
52
|
-
while (p = p.next) {
|
|
53
|
-
ret += s + p.data;
|
|
54
|
-
}return ret;
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
BufferList.prototype.concat = function concat(n) {
|
|
58
|
-
if (this.length === 0) return Buffer.alloc(0);
|
|
59
|
-
if (this.length === 1) return this.head.data;
|
|
60
|
-
var ret = Buffer.allocUnsafe(n >>> 0);
|
|
61
|
-
var p = this.head;
|
|
62
|
-
var i = 0;
|
|
63
|
-
while (p) {
|
|
64
|
-
copyBuffer(p.data, ret, i);
|
|
65
|
-
i += p.data.length;
|
|
66
|
-
p = p.next;
|
|
67
|
-
}
|
|
68
|
-
return ret;
|
|
69
|
-
};
|
|
70
|
-
|
|
71
|
-
return BufferList;
|
|
72
|
-
}();
|
|
73
|
-
|
|
74
|
-
if (util && util.inspect && util.inspect.custom) {
|
|
75
|
-
module.exports.prototype[util.inspect.custom] = function () {
|
|
76
|
-
var obj = util.inspect({ length: this.length });
|
|
77
|
-
return this.constructor.name + ' ' + obj;
|
|
78
|
-
};
|
|
79
|
-
}
|
|
@@ -1,74 +0,0 @@
|
|
|
1
|
-
'use strict';
|
|
2
|
-
|
|
3
|
-
/*<replacement>*/
|
|
4
|
-
|
|
5
|
-
var pna = require('process-nextick-args');
|
|
6
|
-
/*</replacement>*/
|
|
7
|
-
|
|
8
|
-
// undocumented cb() API, needed for core, not for public API
|
|
9
|
-
function destroy(err, cb) {
|
|
10
|
-
var _this = this;
|
|
11
|
-
|
|
12
|
-
var readableDestroyed = this._readableState && this._readableState.destroyed;
|
|
13
|
-
var writableDestroyed = this._writableState && this._writableState.destroyed;
|
|
14
|
-
|
|
15
|
-
if (readableDestroyed || writableDestroyed) {
|
|
16
|
-
if (cb) {
|
|
17
|
-
cb(err);
|
|
18
|
-
} else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
|
|
19
|
-
pna.nextTick(emitErrorNT, this, err);
|
|
20
|
-
}
|
|
21
|
-
return this;
|
|
22
|
-
}
|
|
23
|
-
|
|
24
|
-
// we set destroyed to true before firing error callbacks in order
|
|
25
|
-
// to make it re-entrance safe in case destroy() is called within callbacks
|
|
26
|
-
|
|
27
|
-
if (this._readableState) {
|
|
28
|
-
this._readableState.destroyed = true;
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
// if this is a duplex stream mark the writable part as destroyed as well
|
|
32
|
-
if (this._writableState) {
|
|
33
|
-
this._writableState.destroyed = true;
|
|
34
|
-
}
|
|
35
|
-
|
|
36
|
-
this._destroy(err || null, function (err) {
|
|
37
|
-
if (!cb && err) {
|
|
38
|
-
pna.nextTick(emitErrorNT, _this, err);
|
|
39
|
-
if (_this._writableState) {
|
|
40
|
-
_this._writableState.errorEmitted = true;
|
|
41
|
-
}
|
|
42
|
-
} else if (cb) {
|
|
43
|
-
cb(err);
|
|
44
|
-
}
|
|
45
|
-
});
|
|
46
|
-
|
|
47
|
-
return this;
|
|
48
|
-
}
|
|
49
|
-
|
|
50
|
-
function undestroy() {
|
|
51
|
-
if (this._readableState) {
|
|
52
|
-
this._readableState.destroyed = false;
|
|
53
|
-
this._readableState.reading = false;
|
|
54
|
-
this._readableState.ended = false;
|
|
55
|
-
this._readableState.endEmitted = false;
|
|
56
|
-
}
|
|
57
|
-
|
|
58
|
-
if (this._writableState) {
|
|
59
|
-
this._writableState.destroyed = false;
|
|
60
|
-
this._writableState.ended = false;
|
|
61
|
-
this._writableState.ending = false;
|
|
62
|
-
this._writableState.finished = false;
|
|
63
|
-
this._writableState.errorEmitted = false;
|
|
64
|
-
}
|
|
65
|
-
}
|
|
66
|
-
|
|
67
|
-
function emitErrorNT(self, err) {
|
|
68
|
-
self.emit('error', err);
|
|
69
|
-
}
|
|
70
|
-
|
|
71
|
-
module.exports = {
|
|
72
|
-
destroy: destroy,
|
|
73
|
-
undestroy: undestroy
|
|
74
|
-
};
|