@jsonjoy.com/json-pack 1.1.0 → 1.1.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.
- package/package.json +1 -1
- package/lib/__demos__/cbor.d.ts +0 -1
- package/lib/__demos__/cbor.js +0 -50
- package/lib/__demos__/cbor.js.map +0 -1
- package/lib/__demos__/json.d.ts +0 -1
- package/lib/__demos__/json.js +0 -27
- package/lib/__demos__/json.js.map +0 -1
- package/lib/__demos__/msgpack.d.ts +0 -1
- package/lib/__demos__/msgpack.js +0 -35
- package/lib/__demos__/msgpack.js.map +0 -1
- package/lib/__demos__/ubjson.d.ts +0 -1
- package/lib/__demos__/ubjson.js +0 -27
- package/lib/__demos__/ubjson.js.map +0 -1
package/package.json
CHANGED
package/lib/__demos__/cbor.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/__demos__/cbor.js
DELETED
|
@@ -1,50 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const CborEncoder_1 = require("../cbor/CborEncoder");
|
|
4
|
-
const CborDecoder_1 = require("../cbor/CborDecoder");
|
|
5
|
-
const CborDecoderBase_1 = require("../cbor/CborDecoderBase");
|
|
6
|
-
const encoder = new CborEncoder_1.CborEncoder();
|
|
7
|
-
const decoder = new CborDecoder_1.CborDecoder();
|
|
8
|
-
const decoderBase = new CborDecoderBase_1.CborDecoderBase();
|
|
9
|
-
const pojo = {
|
|
10
|
-
id: 123,
|
|
11
|
-
foo: 'bar',
|
|
12
|
-
tags: ['a', 'b', 'c'],
|
|
13
|
-
nested: {
|
|
14
|
-
a: 1,
|
|
15
|
-
b: 2,
|
|
16
|
-
level2: {
|
|
17
|
-
c: 3,
|
|
18
|
-
},
|
|
19
|
-
},
|
|
20
|
-
};
|
|
21
|
-
console.clear();
|
|
22
|
-
console.log('--------------------------------------------------');
|
|
23
|
-
console.log('Encoding CBOR:');
|
|
24
|
-
const encoded = encoder.encode(pojo);
|
|
25
|
-
console.log(encoded);
|
|
26
|
-
console.log('--------------------------------------------------');
|
|
27
|
-
console.log('Decoding CBOR:');
|
|
28
|
-
const decoded = decoderBase.read(encoded);
|
|
29
|
-
console.log(decoded);
|
|
30
|
-
console.log('--------------------------------------------------');
|
|
31
|
-
console.log('Retrieving values without parsing:');
|
|
32
|
-
decoder.reader.reset(encoded);
|
|
33
|
-
const id = decoder.find(['id']).val();
|
|
34
|
-
decoder.reader.reset(encoded);
|
|
35
|
-
const foo = decoder.find(['foo']).val();
|
|
36
|
-
decoder.reader.reset(encoded);
|
|
37
|
-
const secondTag = decoder.find(['tags', 1]).val();
|
|
38
|
-
decoder.reader.reset(encoded);
|
|
39
|
-
const nested = decoder.find(['nested', 'level2', 'c']).val();
|
|
40
|
-
console.log('id:', id, 'foo:', foo, 'secondTag:', secondTag, 'nested:', nested);
|
|
41
|
-
console.log('--------------------------------------------------');
|
|
42
|
-
console.log('Asserting by value type:');
|
|
43
|
-
decoder.reader.reset(encoded);
|
|
44
|
-
const tagAsString = decoder.find(['tags', 1]).readPrimitiveOrVal();
|
|
45
|
-
console.log({ tagAsString });
|
|
46
|
-
console.log('--------------------------------------------------');
|
|
47
|
-
console.log('Parsing only one level:');
|
|
48
|
-
const decodedLevel = decoder.decodeLevel(encoded);
|
|
49
|
-
console.log(decodedLevel);
|
|
50
|
-
//# sourceMappingURL=cbor.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cbor.js","sourceRoot":"","sources":["../../src/__demos__/cbor.ts"],"names":[],"mappings":";;AAQA,qDAAgD;AAChD,qDAAgD;AAChD,6DAAwD;AAExD,MAAM,OAAO,GAAG,IAAI,yBAAW,EAAE,CAAC;AAClC,MAAM,OAAO,GAAG,IAAI,yBAAW,EAAE,CAAC;AAClC,MAAM,WAAW,GAAG,IAAI,iCAAe,EAAE,CAAC;AAE1C,MAAM,IAAI,GAAG;IACX,E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M,EAAE,CAAC,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAClD,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC9B,MAAM,MAAM,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,QAAQ,EAAE,GAAG,CAAC,CAAC,CAAC,GAAG,EAAE,CAAC;AAC7D,OAAO,CAAC,GAAG,CAAC,KAAK,EAAE,EAAE,EAAE,MAAM,EAAE,GAAG,EAAE,YAAY,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,CAAC,CAAC;AAEhF,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;AAClE,OAAO,CAAC,GAAG,CAAC,0BAA0B,CAAC,CAAC;AACxC,OAAO,CAAC,MAAM,CAAC,KAAK,CAAC,OAAO,CAAC,CAAC;AAC9B,MAAM,WAAW,GAAG,OAAO,CAAC,IAAI,CAAC,CAAC,MAAM,EAAE,CAAC,CAAC,CAAC,CAAC,kBAAkB,EAAE,CAAC;AACnE,OAAO,CAAC,GAAG,CAAC,EAAC,WAAW,EAAC,CAAC,CAAC;AAE3B,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;AAClE,OAAO,CAAC,GAAG,CAAC,yBAAyB,CAAC,CAAC;AACvC,MAAM,YAAY,GAAG,OAAO,CAAC,WAAW,CAAC,OAAO,CAAC,CAAC;AAClD,OAAO,CAAC,GAAG,CAAC,YAAY,CAAC,CAAC"}
|
package/lib/__demos__/json.d.ts
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/__demos__/json.js
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const JsonEncoder_1 = require("../json/JsonEncoder");
|
|
4
|
-
const JsonDecoder_1 = require("../json/JsonDecoder");
|
|
5
|
-
const Writer_1 = require("@jsonjoy.com/util/lib/buffers/Writer");
|
|
6
|
-
const encoder = new JsonEncoder_1.JsonEncoder(new Writer_1.Writer());
|
|
7
|
-
const decoder = new JsonDecoder_1.JsonDecoder();
|
|
8
|
-
const pojo = {
|
|
9
|
-
id: 123,
|
|
10
|
-
foo: 'bar',
|
|
11
|
-
tags: ['a', 'b', 'c'],
|
|
12
|
-
binary: new Uint8Array([1, 2, 3]),
|
|
13
|
-
};
|
|
14
|
-
console.clear();
|
|
15
|
-
console.log('--------------------------------------------------');
|
|
16
|
-
console.log('Encoding JSON:');
|
|
17
|
-
const encoded = encoder.encode(pojo);
|
|
18
|
-
console.log(encoded);
|
|
19
|
-
console.log('--------------------------------------------------');
|
|
20
|
-
console.log('Decoding JSON:');
|
|
21
|
-
const decoded = decoder.read(encoded);
|
|
22
|
-
console.log(decoded);
|
|
23
|
-
console.log('--------------------------------------------------');
|
|
24
|
-
console.log('Binary data:');
|
|
25
|
-
const blob = encoder.encode({ binary: new Uint8Array([1, 2, 3]) });
|
|
26
|
-
console.log(Buffer.from(blob).toString());
|
|
27
|
-
//# sourceMappingURL=json.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"json.js","sourceRoot":"","sources":["../../src/__demos__/json.ts"],"names":[],"mappings":";;AAQA,qDAAgD;AAChD,qDAAgD;AAChD,iEAA4D;AAE5D,MAAM,OAAO,GAAG,IAAI,yBAAW,CAAC,IAAI,eAAM,EAAE,CAAC,CAAC;AAC9C,MAAM,OAAO,GAAG,IAAI,yBAAW,EAAE,CAAC;AAElC,MAAM,IAAI,GAAG;IACX,EAAE,EAAE,GAAG;IACP,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACrB,MAAM,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC;CAClC,CAAC;AAEF,OAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;AAClE,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAC9B,MAAM,OAAO,GAAG,OAAO,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;AACrC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAErB,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;AAClE,OAAO,CAAC,GAAG,CAAC,gBAAgB,CAAC,CAAC;AAC9B,MAAM,OAAO,GAAG,OAAO,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;AACtC,OAAO,CAAC,GAAG,CAAC,OAAO,CAAC,CAAC;AAErB,OAAO,CAAC,GAAG,CAAC,oDAAoD,CAAC,CAAC;AAClE,OAAO,CAAC,GAAG,CAAC,cAAc,CAAC,CAAC;AAC5B,MAAM,IAAI,GAAG,OAAO,CAAC,MAAM,CAAC,EAAC,MAAM,EAAE,IAAI,UAAU,CAAC,CAAC,CAAC,EAAE,CAAC,EAAE,CAAC,CAAC,CAAC,EAAC,CAAC,CAAC;AACjE,OAAO,CAAC,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export {};
|
package/lib/__demos__/msgpack.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const MsgPackEncoder_1 = require("../msgpack/MsgPackEncoder");
|
|
4
|
-
const MsgPackDecoder_1 = require("../msgpack/MsgPackDecoder");
|
|
5
|
-
const encoder = new MsgPackEncoder_1.MsgPackEncoder();
|
|
6
|
-
const decoder = new MsgPackDecoder_1.MsgPackDecoder();
|
|
7
|
-
const pojo = {
|
|
8
|
-
id: 123,
|
|
9
|
-
foo: 'bar',
|
|
10
|
-
tags: ['a', 'b', 'c'],
|
|
11
|
-
nested: {
|
|
12
|
-
a: 1,
|
|
13
|
-
b: 2,
|
|
14
|
-
level2: {
|
|
15
|
-
c: 3,
|
|
16
|
-
},
|
|
17
|
-
},
|
|
18
|
-
};
|
|
19
|
-
console.clear();
|
|
20
|
-
console.log('--------------------------------------------------');
|
|
21
|
-
console.log('Encoding MessagePack:');
|
|
22
|
-
const encoded = encoder.encode(pojo);
|
|
23
|
-
console.log(encoded);
|
|
24
|
-
console.log('--------------------------------------------------');
|
|
25
|
-
console.log('Retrieving values without parsing:');
|
|
26
|
-
decoder.reader.reset(encoded);
|
|
27
|
-
const id = decoder.find(['id']).val();
|
|
28
|
-
decoder.reader.reset(encoded);
|
|
29
|
-
const foo = decoder.find(['foo']).val();
|
|
30
|
-
decoder.reader.reset(encoded);
|
|
31
|
-
const secondTag = decoder.find(['tags', 1]).val();
|
|
32
|
-
decoder.reader.reset(encoded);
|
|
33
|
-
const nested = decoder.find(['nested', 'level2', 'c']).val();
|
|
34
|
-
console.log('id:', id, 'foo:', foo, 'secondTag:', secondTag, 'nested:', nested);
|
|
35
|
-
//# sourceMappingURL=msgpack.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"msgpack.js","sourceRoot":"","sources":["../../src/__demos__/msgpack.ts"],"names":[],"mappings":";;AAQA,8DAAyD;AACzD,8DAAyD;AAEzD,MAAM,OAAO,GAAG,IAAI,+BAAc,EAAE,CAAC;AACrC,MAAM,OAAO,GAAG,IAAI,+BAAc,EAAE,CAAC;AAErC,MAAM,IAAI,GAAG;IACX,EAAE,EAAE,GAAG;IACP,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC;IACrB,MAAM,EAAE;QACN,CAAC,EAAE,CAAC;QACJ,CAAC,EAAE,CAAC;QACJ,MAAM,EAAE;YACN,CAAC,EAAE,CAAC;SACL;KACF;CACF,CAAC;AAEF,OAAO,CAAC,KAAK,EAAE,CAAC;AAEhB,OAAO,CAAC,GAAG,CAAC,o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esModule", { value: true });
|
|
3
|
-
const UbjsonEncoder_1 = require("../ubjson/UbjsonEncoder");
|
|
4
|
-
const UbjsonDecoder_1 = require("../ubjson/UbjsonDecoder");
|
|
5
|
-
const Writer_1 = require("@jsonjoy.com/util/lib/buffers/Writer");
|
|
6
|
-
const encoder = new UbjsonEncoder_1.UbjsonEncoder(new Writer_1.Writer());
|
|
7
|
-
const decoder = new UbjsonDecoder_1.UbjsonDecoder();
|
|
8
|
-
const pojo = {
|
|
9
|
-
id: 123,
|
|
10
|
-
foo: 'bar',
|
|
11
|
-
tags: ['a', 'b', 'c'],
|
|
12
|
-
binary: new Uint8Array([1, 2, 3]),
|
|
13
|
-
};
|
|
14
|
-
console.clear();
|
|
15
|
-
console.log('--------------------------------------------------');
|
|
16
|
-
console.log('Encoding UBJSON:');
|
|
17
|
-
const encoded = encoder.encode(pojo);
|
|
18
|
-
console.log(encoded);
|
|
19
|
-
console.log('--------------------------------------------------');
|
|
20
|
-
console.log('Decoding UBJSON:');
|
|
21
|
-
const decoded = decoder.read(encoded);
|
|
22
|
-
console.log(decoded);
|
|
23
|
-
console.log('--------------------------------------------------');
|
|
24
|
-
console.log('Binary data:');
|
|
25
|
-
const blob = encoder.encode({ binary: new Uint8Array([1, 2, 3]) });
|
|
26
|
-
console.log(Buffer.from(blob).toString());
|
|
27
|
-
//# sourceMappingURL=ubjson.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"ubjson.js","sourceRoot":"","sources":["../../src/__demos__/ubjson.ts"],"names":[],"mappings":";;AAQA,2DAAsD;AACtD,2DAAsD;AACtD,iEAA4D;AAE5D,MAAM,OAAO,GAAG,IAAI,6BAAa,CAAC,IAAI,eAAM,EAAE,CAAC,CAAC;AAChD,MAAM,OAAO,GAAG,IAAI,6BAAa,EAAE,CAAC;AAEpC,MAAM,IAAI,GAAG;IACX,EAAE,EAAE,GAAG;IACP,GAAG,EAAE,KAAK;IACV,IAAI,EAAE,CAAC,GAAG,EAAE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