msgpack-lite 0.1.27 → 0.2.1

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.
@@ -1,79 +0,0 @@
1
- #!/usr/bin/env mocha -R spec
2
-
3
- /*jshint -W053 */
4
-
5
- var assert = require("assert");
6
- var msgpackJS = "../index";
7
- var isBrowser = ("undefined" !== typeof window);
8
- var msgpack = isBrowser && window.msgpack || require(msgpackJS);
9
- var TITLE = __filename.replace(/^.*\//, "");
10
-
11
- var TYPED_ARRAY = {
12
- "Int8Array": [0, 1, 2, 126, 127, -128, -127, -2, -1],
13
- "Uint8Array": [0, 1, 2, 253, 254, 255],
14
- "Uint8ClampedArray": [0, 1, 2, 253, 254, 255],
15
- "Int16Array": [0, 1, 2, 32766, 32767, -32768, -32767, -2, -1],
16
- "Uint16Array": [0, 1, 2, 65534, 65535],
17
- "Int32Array": [0, 1, 2, 2147483646, 2147483647],
18
- "Uint32Array": [0, 1, 2, 4294967294, 4294967295],
19
- "Float32Array": [0, 1, 0.5, 0.25, -0.25, -0.5, -1],
20
- "Float64Array": [0, 1, 0.5, 0.25, -0.25, -0.5, -1]
21
- };
22
-
23
- var ARRAY_BUFFER = {
24
- "ArrayBuffer": [0, 1, 2, 253, 254, 255]
25
- };
26
-
27
- var DATA_VIEW = {
28
- "DataView": [0, 1, 2, 253, 254, 255]
29
- };
30
-
31
- describe(TITLE, function() {
32
- Object.keys(TYPED_ARRAY).forEach(function(name) {
33
- var Class = global[name];
34
- var skip = Class ? it : it.skip;
35
- skip(name, function() {
36
- var sample = TYPED_ARRAY[name];
37
- var source = new Class(sample);
38
- assert.ok(source instanceof Class);
39
- assert.equal(source.length, sample.length);
40
- var encoded = msgpack.encode(source);
41
- var decoded = msgpack.decode(encoded);
42
- var actual = Array.prototype.slice.call(decoded);
43
- assert.deepEqual(actual, sample);
44
- assert.ok(decoded instanceof Class);
45
- });
46
- });
47
-
48
- Object.keys(ARRAY_BUFFER).forEach(function(name) {
49
- var Class = global[name];
50
- var skip = Class ? it : it.skip;
51
- skip(name, function() {
52
- var sample = ARRAY_BUFFER[name];
53
- var source = (new Uint8Array(sample)).buffer;
54
- assert.ok(source instanceof Class);
55
- assert.equal(source.byteLength, sample.length);
56
- var encoded = msgpack.encode(source);
57
- var decoded = msgpack.decode(encoded);
58
- var actual = Array.prototype.slice.call(new Uint8Array(decoded));
59
- assert.deepEqual(actual, sample);
60
- assert.ok(decoded instanceof Class);
61
- });
62
- });
63
-
64
- Object.keys(DATA_VIEW).forEach(function(name) {
65
- var Class = global[name];
66
- var skip = Class ? it : it.skip;
67
- skip(name, function() {
68
- var sample = DATA_VIEW[name];
69
- var source = new DataView((new Uint8Array(sample)).buffer);
70
- assert.ok(source instanceof Class);
71
- assert.equal(source.byteLength, sample.length);
72
- var encoded = msgpack.encode(source);
73
- var decoded = msgpack.decode(encoded);
74
- var actual = Array.prototype.slice.call(new Uint8Array(decoded.buffer));
75
- assert.deepEqual(actual, sample);
76
- assert.ok(decoded instanceof Class);
77
- });
78
- });
79
- });
@@ -1,79 +0,0 @@
1
- #!/usr/bin/env mocha -R spec
2
-
3
- /*jshint -W053 */
4
-
5
- var assert = require("assert");
6
- var msgpackJS = "../index";
7
- var isBrowser = ("undefined" !== typeof window);
8
- var msgpack = isBrowser && window.msgpack || require(msgpackJS);
9
- var TITLE = __filename.replace(/^.*\//, "");
10
-
11
- var HAS_UINT8ARRAY = ("undefined" !== typeof Uint8Array);
12
-
13
- describe(TITLE, function() {
14
- it("ExtBuffer (0x00)", function() {
15
- testExtBuffer(0);
16
- });
17
-
18
- it("ExtBuffer (0x20-0xFF)", function() {
19
- for (var i = 32; i < 256; i++) {
20
- testExtBuffer(i);
21
- }
22
- });
23
-
24
- it("ExtBuffer Array (0x20-0xFF)", function() {
25
- for (var i = 32; i < 256; i++) {
26
- testExtBufferArray(i);
27
- }
28
- });
29
-
30
- function testExtBuffer(type) {
31
- // fixext 8 -- 0xd7
32
- var header = Buffer.from([0xd7, type]);
33
- var content = Buffer.alloc(8);
34
- for (var i = 0; i < 8; i++) {
35
- content[i] = (type + i) & 0x7F;
36
- }
37
- var source = Buffer.concat([header, content]);
38
- var decoded = msgpack.decode(source);
39
- assert.equal(decoded.type, type);
40
- assert.equal(decoded.buffer.length, content.length);
41
- assert.deepEqual(toArray(decoded.buffer), toArray(content));
42
- var encoded = msgpack.encode(decoded);
43
- assert.deepEqual(toArray(encoded), toArray(source));
44
- }
45
-
46
- // Unpack and re-pack an array of extension types.
47
- // Tests, among other things, that the right number of bytes are
48
- // consumed with each ext type read.
49
- function testExtBufferArray(type) {
50
- function content(j) {
51
- var x = j * type;
52
- return Buffer.from([x & 0x7F, (x + 1) & 0x7F]);
53
- }
54
- // fixarray len 10
55
- var arrayHeader = Buffer.from([0x9a]);
56
- var fullBuffer = arrayHeader;
57
- for (var j = 0; j < 10; j++) {
58
- // fixext 2 -- 0xd5
59
- var header = Buffer.from([0xd5, type]);
60
- fullBuffer = Buffer.concat([fullBuffer, header, content(j)]);
61
- }
62
- var decoded = msgpack.decode(fullBuffer);
63
- assert.equal(true, decoded instanceof Array);
64
- assert.equal(decoded.length, 10);
65
- for (j = 0; j < 10; j++) {
66
- assert.equal(decoded[j].type, type);
67
- assert.equal(decoded[j].buffer.length, 2);
68
- assert.deepEqual(decoded[j].buffer, content(j));
69
- }
70
- var encoded = msgpack.encode(decoded);
71
- assert.deepEqual(encoded, fullBuffer);
72
- }
73
-
74
- });
75
-
76
- function toArray(array) {
77
- if (HAS_UINT8ARRAY && array instanceof ArrayBuffer) array = new Uint8Array(array);
78
- return Array.prototype.slice.call(array);
79
- }
package/test/24.int64.js DELETED
@@ -1,76 +0,0 @@
1
- #!/usr/bin/env mocha -R spec
2
-
3
- /*jshint -W053 */
4
-
5
- var Int64Buffer = require("int64-buffer");
6
- var Uint64BE = Int64Buffer.Uint64BE;
7
- var Int64BE = Int64Buffer.Int64BE;
8
-
9
- var assert = require("assert");
10
- var msgpackJS = "../index";
11
- var isBrowser = ("undefined" !== typeof window);
12
- var msgpack = isBrowser && window.msgpack || require(msgpackJS);
13
- var TITLE = __filename.replace(/^.*\//, "");
14
-
15
- describe(TITLE, function() {
16
- var options = {};
17
-
18
- it("createCodec({int64: true})", function() {
19
- var codec = msgpack.createCodec({int64: true});
20
- assert.ok(codec);
21
- options.codec = codec;
22
- });
23
-
24
- it("Uint64BE", function() {
25
- [
26
- 0, 1, Math.pow(2, 16), Math.pow(2, 32), Math.pow(2, 48)
27
- ].forEach(function(value) {
28
- var source = Uint64BE(value);
29
- assert.equal(+source, value);
30
- var encoded = msgpack.encode(source, options);
31
- assert.equal(encoded[0], 0xcf);
32
- assert.equal(encoded.length, 9);
33
- var decoded = msgpack.decode(encoded, options);
34
- assert.equal(+decoded, value);
35
- });
36
-
37
- [
38
- "0", "1", "123456789abcdef0", "fedcba9876543210"
39
- ].forEach(function(value) {
40
- var source = Uint64BE(value, 16);
41
- assert.equal(source.toString(16), value);
42
- var encoded = msgpack.encode(source, options);
43
- assert.equal(encoded[0], 0xcf);
44
- assert.equal(encoded.length, 9);
45
- var decoded = msgpack.decode(encoded, options);
46
- assert.equal(decoded.toString(16), value);
47
- });
48
- });
49
-
50
- it("Int64BE", function() {
51
- [
52
- 0, 1, Math.pow(2, 16), Math.pow(2, 32), Math.pow(2, 48),
53
- -1, -Math.pow(2, 16), -Math.pow(2, 32), -Math.pow(2, 48)
54
- ].forEach(function(value) {
55
- var source = Int64BE(value);
56
- assert.equal(+source, value);
57
- var encoded = msgpack.encode(source, options);
58
- assert.equal(encoded[0], 0xd3);
59
- assert.equal(encoded.length, 9);
60
- var decoded = msgpack.decode(encoded, options);
61
- assert.equal(+decoded, value);
62
- });
63
-
64
- [
65
- "0", "1", "-1", "123456789abcdef0", "-123456789abcdef0"
66
- ].forEach(function(value) {
67
- var source = Int64BE(value, 16);
68
- assert.equal(source.toString(16), value);
69
- var encoded = msgpack.encode(source, options);
70
- assert.equal(encoded[0], 0xd3);
71
- assert.equal(encoded.length, 9);
72
- var decoded = msgpack.decode(encoded, options);
73
- assert.equal(decoded.toString(16), value);
74
- });
75
- });
76
- });
package/test/26.es6.js DELETED
@@ -1,20 +0,0 @@
1
- #!/usr/bin/env mocha -R spec
2
-
3
- var assert = require("assert");
4
- var msgpackJS = "../index";
5
- var isBrowser = ("undefined" !== typeof window);
6
- var msgpack = isBrowser && window.msgpack || require(msgpackJS);
7
- var TITLE = __filename.replace(/^.*\//, "");
8
-
9
- describe(TITLE, function() {
10
-
11
- var skip = ("undefined" !== typeof Symbol) ? it : it.skip;
12
- skip("Symbol", function() {
13
- assert.deepEqual(toArray(msgpack.encode(Symbol("foo"))), [0xc0]);
14
- });
15
-
16
- });
17
-
18
- function toArray(buffer) {
19
- return Array.prototype.slice.call(buffer);
20
- }
package/test/27.usemap.js DELETED
@@ -1,66 +0,0 @@
1
- #!/usr/bin/env mocha -R spec
2
-
3
- var assert = require("assert");
4
- var msgpackJS = "../index";
5
- var isBrowser = ("undefined" !== typeof window);
6
- var HAS_MAP = ("undefined" !== typeof Map);
7
- var msgpack = isBrowser && window.msgpack || require(msgpackJS);
8
- var TITLE = __filename.replace(/^.*\//, "");
9
-
10
- function pattern(min, max, offset) {
11
- var array = [];
12
- var check = {};
13
- var val = min - 1;
14
- while (val <= max) {
15
- if (min <= val && !check[val]) array.push(val);
16
- check[val++] = 1;
17
- if (val <= max && !check[val]) array.push(val);
18
- check[val++] = 1;
19
- if (val <= max && !check[val]) array.push(val);
20
- check[val--] = 1;
21
- val = val ? val * 2 - 1 : 1;
22
- }
23
- return array;
24
- }
25
-
26
- // Run these tests when Map is available
27
- var describeSkip = HAS_MAP ? describe : describe.skip;
28
-
29
- describeSkip(TITLE, function() {
30
-
31
- it("Map (small)", function() {
32
- pattern(0, 257).forEach(function(length) {
33
- var value = new Map();
34
- assert.equal(true, value instanceof Map);
35
- for (var i = 0; i < length; i++) {
36
- var key = String.fromCharCode(i);
37
- value.set(key, length);
38
- }
39
- assert.equal(value.size, length);
40
- var options = {codec: msgpack.createCodec({usemap: true})};
41
- var encoded = msgpack.encode(value, options);
42
- var decoded = msgpack.decode(encoded, options);
43
- assert.equal(true, decoded instanceof Map);
44
- assert.equal(decoded.size, length);
45
- assert.equal(decoded.get(String.fromCharCode(0)), value.get(String.fromCharCode(0)));
46
- assert.equal(decoded.get(String.fromCharCode(length - 1)), value.get(String.fromCharCode(length - 1)));
47
- });
48
- });
49
-
50
- it("Map (large)", function() {
51
- this.timeout(30000);
52
- pattern(65536, 65537).forEach(function(length) {
53
- var value = new Map();
54
- for (var i = 0; i < length; i++) {
55
- value.set(i, length);
56
- }
57
- assert.equal(value.size, length);
58
- var options = {codec: msgpack.createCodec({usemap: true})};
59
- var encoded = msgpack.encode(value, options);
60
- var decoded = msgpack.decode(encoded, options);
61
- assert.equal(decoded.size, length);
62
- assert.equal(decoded.get(0), value.get(0));
63
- assert.equal(decoded.get(length - 1), value.get(length - 1));
64
- });
65
- });
66
- });
package/test/30.stream.js DELETED
@@ -1,167 +0,0 @@
1
- #!/usr/bin/env mocha -R spec
2
-
3
- var assert = require("assert");
4
- var Stream = require("stream");
5
- var concat = require("concat-stream");
6
-
7
- var msgpack = require("../index");
8
- var TITLE = __filename.replace(/^.*\//, "");
9
- var example = require("./example.json");
10
-
11
- var src = [
12
- ["foo"],
13
- ["bar"],
14
- ["baz"]
15
- ];
16
-
17
- var encoded = [
18
- msgpack.encode(src[0]),
19
- msgpack.encode(src[1]),
20
- msgpack.encode(src[2])
21
- ];
22
-
23
- var encodeall = Buffer.concat(encoded);
24
-
25
- // invalid msgpack type
26
- var invalencoded = Buffer.from([0xc1]);
27
-
28
- describe(TITLE, function() {
29
-
30
- it("msgpack.createEncodeStream()", function(done) {
31
- var encoder = msgpack.createEncodeStream();
32
- encoder.pipe(concat(onEnd));
33
- encoder.write(src[0]);
34
- encoder.write(src[1]);
35
- encoder.write(src[2]);
36
- encoder.end();
37
-
38
- function onEnd(data) {
39
- assert.deepEqual(data, encodeall);
40
- done();
41
- }
42
- });
43
-
44
- it("msgpack.createDecodeStream()", function(done) {
45
- var count = 0;
46
- var decoder = msgpack.createDecodeStream();
47
-
48
- decoder.on("data", onData);
49
- decoder.write(encoded[0]);
50
- decoder.write(encoded[1]);
51
- decoder.write(encoded[2]);
52
- decoder.end();
53
-
54
- function onData(data) {
55
- assert.deepEqual(data, src[count++]);
56
- if (count === 3) done();
57
- }
58
- });
59
-
60
- it("pipe(encoder).pipe(decoder)", function(done) {
61
- var count = 0;
62
- var inputStream = new Stream.PassThrough({objectMode: true});
63
- var encoder = msgpack.createEncodeStream();
64
- var passThrough = new Stream.PassThrough();
65
- var decoder = msgpack.createDecodeStream();
66
- var outputStream = new Stream.PassThrough({objectMode: true});
67
-
68
- inputStream.pipe(encoder).pipe(passThrough).pipe(decoder).pipe(outputStream);
69
- outputStream.on("data", onData);
70
- inputStream.write(src[0]);
71
- inputStream.write(src[1]);
72
- inputStream.write(src[2]);
73
- inputStream.end();
74
-
75
- function onData(data) {
76
- assert.deepEqual(data, src[count++]);
77
- if (count === 3) done();
78
- }
79
- });
80
-
81
- it("pipe(decoder).pipe(encoder)", function(done) {
82
- var inputStream = new Stream.PassThrough();
83
- var decoder = msgpack.createDecodeStream();
84
- var passThrough = new Stream.PassThrough({objectMode: true});
85
- var encoder = msgpack.createEncodeStream();
86
-
87
- inputStream.pipe(decoder).pipe(passThrough).pipe(encoder).pipe(concat(onEnd));
88
- inputStream.write(encoded[0]);
89
- inputStream.write(encoded[1]);
90
- inputStream.write(encoded[2]);
91
- inputStream.end();
92
-
93
- function onEnd(data) {
94
- assert.deepEqual(data, encodeall);
95
- done();
96
- }
97
- });
98
-
99
- it("write()", function(done) {
100
- var count = 0;
101
- var buf = msgpack.encode(example);
102
- var decoder = msgpack.createDecodeStream();
103
- decoder.on("data", onData);
104
-
105
- for (var i = 0; i < 3; i++) {
106
- Array.prototype.forEach.call(buf, each);
107
- }
108
-
109
- // decode stream should be closed
110
- decoder.end();
111
-
112
- // write a single byte into the decode stream
113
- function each(x) {
114
- decoder.write(Buffer.from([x]));
115
- }
116
-
117
- function onData(data) {
118
- assert.deepEqual(data, example);
119
- if (++count === 3) done();
120
- }
121
- });
122
-
123
- it("msgpack.createDecodeStream().on('error',fn)", function(done) {
124
- var decoder = msgpack.createDecodeStream();
125
-
126
- decoder.on("error", function(e) {
127
- if (!(e instanceof Error)) return done(new Error("should be an error"));
128
- if (!/Invalid type/.test(e.message)) return done(new Error("unexpected: " + e.message));
129
- done();
130
- });
131
-
132
- decoder.on("data", function() {
133
- // throwing here would be captured by the try/catch under test
134
- done(new Error("should not emit data"));
135
- });
136
-
137
- decoder.end(invalencoded);
138
- });
139
-
140
- it("msgpack.createEncodeStream().on('error',fn)", function(done) {
141
- var circular = [];
142
- circular.push(circular);
143
-
144
- // the error event should carry what the synchronous API throws
145
- var expected;
146
- try {
147
- msgpack.encode(circular);
148
- } catch (e) {
149
- expected = e;
150
- }
151
- assert.ok(expected instanceof Error, "encode() should throw for circular references");
152
-
153
- var encoder = msgpack.createEncodeStream();
154
-
155
- encoder.on("error", function(e) {
156
- if (!(e instanceof Error)) return done(new Error("should be an error"));
157
- if (e.name !== expected.name) return done(new Error("unexpected: " + e.name));
158
- done();
159
- });
160
-
161
- // partial output is flushed as the internal buffer overflows
162
- encoder.resume();
163
-
164
- encoder.end(circular);
165
- });
166
-
167
- });
package/test/50.compat.js DELETED
@@ -1,58 +0,0 @@
1
- #!/usr/bin/env mocha -R spec
2
-
3
- var assert = require("assert");
4
-
5
- var msgpack = require("../index");
6
- var TITLE = __filename.replace(/^.*\//, "");
7
-
8
- var data = require("./example.json");
9
-
10
- describe(TITLE, function() {
11
- test("msgpack", function(they) {
12
- assert.deepEqual(they.unpack(msgpack.encode(data)), data);
13
- assert.deepEqual(msgpack.decode(Buffer.from(they.pack(data))), data);
14
- });
15
-
16
- test("msgpack-js", function(they) {
17
- assert.deepEqual(they.decode(msgpack.encode(data)), data);
18
- assert.deepEqual(msgpack.decode(Buffer.from(they.encode(data))), data);
19
- });
20
-
21
- test("msgpack-js-v5", function(they) {
22
- assert.deepEqual(they.decode(msgpack.encode(data)), data);
23
- assert.deepEqual(msgpack.decode(Buffer.from(they.encode(data))), data);
24
- });
25
-
26
- test("msgpack5", function(they) {
27
- they = they();
28
- assert.deepEqual(they.decode(msgpack.encode(data)), data);
29
- assert.deepEqual(msgpack.decode(Buffer.from(they.encode(data))), data);
30
- });
31
-
32
- test("notepack", function(they) {
33
- assert.deepEqual(they.decode(msgpack.encode(data)), data);
34
- assert.deepEqual(msgpack.decode(Buffer.from(they.encode(data))), data);
35
- });
36
-
37
- test("msgpack-unpack", function(they) {
38
- assert.deepEqual(they(msgpack.encode(data)), data);
39
- });
40
-
41
- test("msgpack.codec", function(they) {
42
- they = they.msgpack;
43
- assert.deepEqual(they.unpack(msgpack.encode(data)), data);
44
- assert.deepEqual(msgpack.decode(Buffer.from(they.pack(data))), data);
45
- });
46
- });
47
-
48
- function test(name, func) {
49
- var they;
50
- var method = it;
51
- try {
52
- they = require(name);
53
- } catch (e) {
54
- method = it.skip;
55
- name += ": " + e;
56
- }
57
- method(name, func.bind(null, they));
58
- }
@@ -1,26 +0,0 @@
1
- #!/usr/bin/env mocha -R spec
2
-
3
- var assert = require("assert");
4
-
5
- var encode = require("../lib/encode").encode;
6
- var ExtBuffer = require("../lib/ext-buffer").ExtBuffer;
7
- var TITLE = __filename.replace(/^.*\//, "");
8
-
9
- describe(TITLE, function() {
10
- it("encode", function() {
11
- // int
12
- assert.deepEqual(toArray(encode(1)), [1]);
13
-
14
- // str
15
- assert.deepEqual(toArray(encode("a")), [161, 97]);
16
-
17
- // ExtBuffer
18
- var ext = new ExtBuffer(Buffer.from([1]), 127);
19
- assert.ok(ext instanceof ExtBuffer);
20
- assert.deepEqual(toArray(encode(ext)), [212, 127, 1]);
21
- });
22
- });
23
-
24
- function toArray(buffer) {
25
- return Array.prototype.slice.call(buffer);
26
- }
@@ -1,23 +0,0 @@
1
- #!/usr/bin/env mocha -R spec
2
-
3
- var assert = require("assert");
4
-
5
- var decode = require("../lib/decode").decode;
6
- var ExtBuffer = require("../lib/ext-buffer").ExtBuffer;
7
- var TITLE = __filename.replace(/^.*\//, "");
8
-
9
- describe(TITLE, function() {
10
- it("decode", function() {
11
- // int
12
- assert.equal(decode([1]), 1);
13
-
14
- // str
15
- assert.equal(decode([161, 97]), "a");
16
-
17
- // ExtBuffer
18
- var ext = decode(Buffer.from([212, 127, 1]));
19
- assert.ok(ext instanceof ExtBuffer);
20
- assert.equal(ext.buffer[0], 1);
21
- assert.equal(ext.type, 127);
22
- });
23
- });
@@ -1,77 +0,0 @@
1
- #!/usr/bin/env mocha -R spec
2
-
3
- var TITLE = __filename.replace(/^.*\//, "");
4
-
5
- describe(TITLE, function() {
6
- var mdeps;
7
- var itSkip = it;
8
-
9
- try {
10
- mdeps = require("browserify/node_modules/module-deps");
11
- } catch (e) {
12
- itSkip = it.skip;
13
- }
14
-
15
- // index.js should not require stream modules
16
-
17
- itSkip("index.js dependencies", function(next) {
18
- var opt = {file: __dirname + "/../index.js"};
19
- var list = [];
20
- mdeps().on("data", onData).on("end", onEnd).end(opt);
21
-
22
- function onData(data) {
23
- list.push(data.file);
24
- }
25
-
26
- function onEnd() {
27
- var hit = list.filter(check)[0];
28
- next(hit && new Error(hit));
29
- }
30
-
31
- function check(value) {
32
- return value.match(/stream/) && !value.match(/node_modules/);
33
- }
34
- });
35
-
36
- // decode.js should not require encode|write modules
37
-
38
- itSkip("decode.js dependencies", function(next) {
39
- var opt = {file: __dirname + "/../lib/decode.js"};
40
- var list = [];
41
- mdeps().on("data", onData).on("end", onEnd).end(opt);
42
-
43
- function onData(data) {
44
- list.push(data.file);
45
- }
46
-
47
- function onEnd() {
48
- var hit = list.filter(check)[0];
49
- next(hit && new Error(hit));
50
- }
51
-
52
- function check(value) {
53
- return value.match(/encode|write/) && !value.match(/node_modules/);
54
- }
55
- });
56
-
57
- // encode.js should not require decode|read modules
58
-
59
- itSkip("encode.js dependencies", function(next) {
60
- var opt = {file: __dirname + "/../lib/encode.js"};
61
- var list = [];
62
- mdeps().on("data", onData).on("end", onEnd).end(opt);
63
-
64
- function onData(data) {
65
- list.push(data.file);
66
- }
67
-
68
- function onEnd() {
69
- var hit = list.filter(check)[0];
70
- next(hit && new Error(hit));
71
- }
72
-
73
- function check(value) {
74
- return value.match(/decode|read/) && !value.match(/node_modules/);
75
- }
76
- });
77
- });