msgpack-lite 0.1.26 → 0.2.0
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/LICENSE +1 -1
- package/README.md +44 -164
- package/dist/msgpack.min.js +1 -2
- package/lib/bufferish-buffer.js +1 -1
- package/lib/decode-stream.js +7 -3
- package/lib/encode-stream.js +12 -4
- package/lib/ext-unpacker.js +1 -1
- package/lib/write-type.js +5 -0
- package/package.json +30 -19
- package/.npmignore +0 -8
- package/.travis.yml +0 -26
- package/.zuul.yml +0 -20
- package/Makefile +0 -48
- package/bower.json +0 -34
- package/lib/benchmark-stream.js +0 -247
- package/lib/benchmark.js +0 -157
- package/test/10.encode.js +0 -218
- package/test/11.decode.js +0 -371
- package/test/12.encoder.js +0 -36
- package/test/13.decoder.js +0 -32
- package/test/14.codec.js +0 -95
- package/test/15.useraw.js +0 -92
- package/test/16.binarraybuffer.js +0 -91
- package/test/17.uint8array.js +0 -43
- package/test/18.utf8.js +0 -59
- package/test/20.roundtrip.js +0 -220
- package/test/21.ext.js +0 -85
- package/test/22.typedarray.js +0 -79
- package/test/23.extbuffer.js +0 -79
- package/test/24.int64.js +0 -76
- package/test/26.es6.js +0 -20
- package/test/27.usemap.js +0 -66
- package/test/30.stream.js +0 -119
- package/test/50.compat.js +0 -58
- package/test/61.encode-only.js +0 -26
- package/test/62.decode-only.js +0 -23
- package/test/63.module-deps.js +0 -77
- package/test/example.json +0 -52
- package/test/zuul/ie.html +0 -4
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,119 +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
|
-
describe(TITLE, function() {
|
|
26
|
-
|
|
27
|
-
it("msgpack.createEncodeStream()", function(done) {
|
|
28
|
-
var encoder = msgpack.createEncodeStream();
|
|
29
|
-
encoder.pipe(concat(onEnd));
|
|
30
|
-
encoder.write(src[0]);
|
|
31
|
-
encoder.write(src[1]);
|
|
32
|
-
encoder.write(src[2]);
|
|
33
|
-
encoder.end();
|
|
34
|
-
|
|
35
|
-
function onEnd(data) {
|
|
36
|
-
assert.deepEqual(data, encodeall);
|
|
37
|
-
done();
|
|
38
|
-
}
|
|
39
|
-
});
|
|
40
|
-
|
|
41
|
-
it("msgpack.createDecodeStream()", function(done) {
|
|
42
|
-
var count = 0;
|
|
43
|
-
var decoder = msgpack.createDecodeStream();
|
|
44
|
-
|
|
45
|
-
decoder.on("data", onData);
|
|
46
|
-
decoder.write(encoded[0]);
|
|
47
|
-
decoder.write(encoded[1]);
|
|
48
|
-
decoder.write(encoded[2]);
|
|
49
|
-
decoder.end();
|
|
50
|
-
|
|
51
|
-
function onData(data) {
|
|
52
|
-
assert.deepEqual(data, src[count++]);
|
|
53
|
-
if (count === 3) done();
|
|
54
|
-
}
|
|
55
|
-
});
|
|
56
|
-
|
|
57
|
-
it("pipe(encoder).pipe(decoder)", function(done) {
|
|
58
|
-
var count = 0;
|
|
59
|
-
var inputStream = new Stream.PassThrough({objectMode: true});
|
|
60
|
-
var encoder = msgpack.createEncodeStream();
|
|
61
|
-
var passThrough = new Stream.PassThrough();
|
|
62
|
-
var decoder = msgpack.createDecodeStream();
|
|
63
|
-
var outputStream = new Stream.PassThrough({objectMode: true});
|
|
64
|
-
|
|
65
|
-
inputStream.pipe(encoder).pipe(passThrough).pipe(decoder).pipe(outputStream);
|
|
66
|
-
outputStream.on("data", onData);
|
|
67
|
-
inputStream.write(src[0]);
|
|
68
|
-
inputStream.write(src[1]);
|
|
69
|
-
inputStream.write(src[2]);
|
|
70
|
-
inputStream.end();
|
|
71
|
-
|
|
72
|
-
function onData(data) {
|
|
73
|
-
assert.deepEqual(data, src[count++]);
|
|
74
|
-
if (count === 3) done();
|
|
75
|
-
}
|
|
76
|
-
});
|
|
77
|
-
|
|
78
|
-
it("pipe(decoder).pipe(encoder)", function(done) {
|
|
79
|
-
var inputStream = new Stream.PassThrough();
|
|
80
|
-
var decoder = msgpack.createDecodeStream();
|
|
81
|
-
var passThrough = new Stream.PassThrough({objectMode: true});
|
|
82
|
-
var encoder = msgpack.createEncodeStream();
|
|
83
|
-
|
|
84
|
-
inputStream.pipe(decoder).pipe(passThrough).pipe(encoder).pipe(concat(onEnd));
|
|
85
|
-
inputStream.write(encoded[0]);
|
|
86
|
-
inputStream.write(encoded[1]);
|
|
87
|
-
inputStream.write(encoded[2]);
|
|
88
|
-
inputStream.end();
|
|
89
|
-
|
|
90
|
-
function onEnd(data) {
|
|
91
|
-
assert.deepEqual(data, encodeall);
|
|
92
|
-
done();
|
|
93
|
-
}
|
|
94
|
-
});
|
|
95
|
-
|
|
96
|
-
it("write()", function(done) {
|
|
97
|
-
var count = 0;
|
|
98
|
-
var buf = msgpack.encode(example);
|
|
99
|
-
var decoder = msgpack.createDecodeStream();
|
|
100
|
-
decoder.on("data", onData);
|
|
101
|
-
|
|
102
|
-
for (var i = 0; i < 3; i++) {
|
|
103
|
-
Array.prototype.forEach.call(buf, each);
|
|
104
|
-
}
|
|
105
|
-
|
|
106
|
-
// decode stream should be closed
|
|
107
|
-
decoder.end();
|
|
108
|
-
|
|
109
|
-
// write a single byte into the decode stream
|
|
110
|
-
function each(x) {
|
|
111
|
-
decoder.write(Buffer([x]));
|
|
112
|
-
}
|
|
113
|
-
|
|
114
|
-
function onData(data) {
|
|
115
|
-
assert.deepEqual(data, example);
|
|
116
|
-
if (++count === 3) done();
|
|
117
|
-
}
|
|
118
|
-
});
|
|
119
|
-
});
|
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(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(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(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(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(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(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
|
-
}
|
package/test/61.encode-only.js
DELETED
|
@@ -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(new Buffer([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
|
-
}
|
package/test/62.decode-only.js
DELETED
|
@@ -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(new Buffer([212, 127, 1]));
|
|
19
|
-
assert.ok(ext instanceof ExtBuffer);
|
|
20
|
-
assert.equal(ext.buffer[0], 1);
|
|
21
|
-
assert.equal(ext.type, 127);
|
|
22
|
-
});
|
|
23
|
-
});
|
package/test/63.module-deps.js
DELETED
|
@@ -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
|
-
});
|
package/test/example.json
DELETED
|
@@ -1,52 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"int0": 0,
|
|
3
|
-
"int1": 1,
|
|
4
|
-
"int1-": -1,
|
|
5
|
-
"int8": 255,
|
|
6
|
-
"int8-": -255,
|
|
7
|
-
"int16": 256,
|
|
8
|
-
"int16-": -256,
|
|
9
|
-
"int32": 65536,
|
|
10
|
-
"int32-": -65536,
|
|
11
|
-
"nil": null,
|
|
12
|
-
"true": true,
|
|
13
|
-
"false": false,
|
|
14
|
-
"float": 0.5,
|
|
15
|
-
"float-": -0.5,
|
|
16
|
-
"string0": "",
|
|
17
|
-
"string1": "A",
|
|
18
|
-
"string4": "foobarbaz",
|
|
19
|
-
"string8": "Omnes viae Romam ducunt.",
|
|
20
|
-
"string16": "L’homme n’est qu’un roseau, le plus faible de la nature ; mais c’est un roseau pensant. Il ne faut pas que l’univers entier s’arme pour l’écraser : une vapeur, une goutte d’eau, suffit pour le tuer. Mais, quand l’univers l’écraserait, l’homme serait encore plus noble que ce qui le tue, puisqu’il sait qu’il meurt, et l’avantage que l’univers a sur lui, l’univers n’en sait rien. Toute notre dignité consiste donc en la pensée. C’est de là qu’il faut nous relever et non de l’espace et de la durée, que nous ne saurions remplir. Travaillons donc à bien penser : voilà le principe de la morale.",
|
|
21
|
-
"array0": [],
|
|
22
|
-
"array1": [
|
|
23
|
-
"foo"
|
|
24
|
-
],
|
|
25
|
-
"array8": [
|
|
26
|
-
1,
|
|
27
|
-
2,
|
|
28
|
-
4,
|
|
29
|
-
8,
|
|
30
|
-
16,
|
|
31
|
-
32,
|
|
32
|
-
64,
|
|
33
|
-
128,
|
|
34
|
-
256,
|
|
35
|
-
512,
|
|
36
|
-
1024,
|
|
37
|
-
2048,
|
|
38
|
-
4096,
|
|
39
|
-
8192,
|
|
40
|
-
16384,
|
|
41
|
-
32768,
|
|
42
|
-
65536,
|
|
43
|
-
131072,
|
|
44
|
-
262144,
|
|
45
|
-
524288,
|
|
46
|
-
1048576
|
|
47
|
-
],
|
|
48
|
-
"map0": {},
|
|
49
|
-
"map1": {
|
|
50
|
-
"foo": "bar"
|
|
51
|
-
}
|
|
52
|
-
}
|
package/test/zuul/ie.html
DELETED