@ac-kit/format-cbor 0.1.0 → 0.1.2
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/CHANGELOG.md +33 -0
- package/dist/json-bridge.d.ts.map +1 -1
- package/dist/json-bridge.js +3 -2
- package/dist/json-bridge.js.map +1 -1
- package/package.json +6 -6
package/CHANGELOG.md
ADDED
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
# @ac-kit/format-cbor
|
|
2
|
+
|
|
3
|
+
## 0.1.2
|
|
4
|
+
|
|
5
|
+
### Patch Changes
|
|
6
|
+
|
|
7
|
+
- Updated dependencies [a5c4d66]
|
|
8
|
+
- Updated dependencies [a5c4d66]
|
|
9
|
+
- Updated dependencies [a5c4d66]
|
|
10
|
+
- Updated dependencies [a5c4d66]
|
|
11
|
+
- @ac-kit/algo@0.2.0
|
|
12
|
+
- @ac-kit/math-numbers@0.2.0
|
|
13
|
+
- @ac-kit/core@0.3.0
|
|
14
|
+
- @ac-kit/format-core@0.1.2
|
|
15
|
+
|
|
16
|
+
## 0.1.1
|
|
17
|
+
|
|
18
|
+
### Patch Changes
|
|
19
|
+
|
|
20
|
+
- a493b4a: Store a parsed key named `__proto__` as an ordinary entry rather than letting it
|
|
21
|
+
reach the prototype setter: CBOR map keys in `dataValueToJson`, unrecognised
|
|
22
|
+
`.editorconfig` properties, and ASN.1 component names in the BER, CER, DER and
|
|
23
|
+
PER decoders. `format-shell` already did this through a local helper, which is
|
|
24
|
+
now `@ac-kit/core`'s `setRecordEntry`.
|
|
25
|
+
- Updated dependencies [a493b4a]
|
|
26
|
+
- Updated dependencies [a493b4a]
|
|
27
|
+
- Updated dependencies [a493b4a]
|
|
28
|
+
- Updated dependencies [2ab5593]
|
|
29
|
+
- Updated dependencies [a493b4a]
|
|
30
|
+
- @ac-kit/core@0.2.0
|
|
31
|
+
- @ac-kit/algo@0.1.1
|
|
32
|
+
- @ac-kit/format-core@0.1.1
|
|
33
|
+
- @ac-kit/math-numbers@0.1.1
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-bridge.d.ts","sourceRoot":"","sources":["../src/json-bridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-bridge.d.ts","sourceRoot":"","sources":["../src/json-bridge.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAE3C,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,UAAU,CAAC;AAE1C;;;;;;;;;;;;;GAaG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAmC3D;AAED;;;;;;GAMG;AACH,wBAAgB,eAAe,CAAC,KAAK,EAAE,SAAS,GAAG,SAAS,CAoB3D"}
|
package/dist/json-bridge.js
CHANGED
|
@@ -1,3 +1,4 @@
|
|
|
1
|
+
import { setRecordEntry } from "@ac-kit/core";
|
|
1
2
|
/**
|
|
2
3
|
* Converts a {@link DataValue} to a {@link JsonValue}, following the
|
|
3
4
|
* non-normative advice in RFC 8949 §6.1.
|
|
@@ -30,7 +31,7 @@ export function dataValueToJson(value) {
|
|
|
30
31
|
if (key.kind !== "text") {
|
|
31
32
|
throw new Error(`Cannot convert a CBOR map with a non-text-string key (${key.kind}) to a JSON object`);
|
|
32
33
|
}
|
|
33
|
-
result
|
|
34
|
+
setRecordEntry(result, key.value, dataValueToJson(entryValue));
|
|
34
35
|
}
|
|
35
36
|
return result;
|
|
36
37
|
}
|
|
@@ -61,7 +62,7 @@ export function jsonToDataValue(value) {
|
|
|
61
62
|
if (typeof value === "string")
|
|
62
63
|
return { kind: "text", value };
|
|
63
64
|
if (typeof value === "number") {
|
|
64
|
-
if (Number.
|
|
65
|
+
if (Number.isSafeInteger(value)) {
|
|
65
66
|
return { kind: "int", value: BigInt(value) };
|
|
66
67
|
}
|
|
67
68
|
return { kind: "float", value };
|
package/dist/json-bridge.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"json-bridge.js","sourceRoot":"","sources":["../src/json-bridge.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"json-bridge.js","sourceRoot":"","sources":["../src/json-bridge.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,cAAc,CAAC;AAK9C;;;;;;;;;;;;;GAaG;AACH,MAAM,UAAU,eAAe,CAAC,KAAgB;IAC/C,QAAQ,KAAK,CAAC,IAAI,EAAE,CAAC;QACpB,KAAK,KAAK;YACT,OAAO,MAAM,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC;QAC5B,KAAK,OAAO;YACX,OAAO,MAAM,CAAC,QAAQ,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC,KAAK,CAAC,KAAK,CAAC,CAAC,CAAC,IAAI,CAAC;QAC1D,KAAK,OAAO;YACX,OAAO,KAAK,CAAC,KAAK,CAAC,QAAQ,CAAC,EAAE,QAAQ,EAAE,WAAW,EAAE,WAAW,EAAE,IAAI,EAAE,CAAC,CAAC;QAC3E,KAAK,MAAM;YACV,OAAO,KAAK,CAAC,KAAK,CAAC;QACpB,KAAK,OAAO;YACX,OAAO,KAAK,CAAC,KAAK,CAAC,GAAG,CAAC,eAAe,CAAC,CAAC;QACzC,KAAK,KAAK,EAAE,CAAC;YACZ,MAAM,MAAM,GAA8B,EAAE,CAAC;YAC7C,KAAK,MAAM,CAAC,GAAG,EAAE,UAAU,CAAC,IAAI,KAAK,CAAC,OAAO,EAAE,CAAC;gBAC/C,IAAI,GAAG,CAAC,IAAI,KAAK,MAAM,EAAE,CAAC;oBACzB,MAAM,IAAI,KAAK,CACd,yDAAyD,GAAG,CAAC,IAAI,oBAAoB,CACrF,CAAC;gBACH,CAAC;gBACD,cAAc,CAAC,MAAM,EAAE,GAAG,CAAC,KAAK,EAAE,eAAe,CAAC,UAAU,CAAC,CAAC,CAAC;YAChE,CAAC;YACD,OAAO,MAAM,CAAC;QACf,CAA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AAI,EAAE,MAAM,EAAE,KAAK,EAAE,GAAG,EAAE,EAAE,eAAe,CAAC,UAAU,CAAC,CAAU,CACrE;KACD,CAAC;AACH,CAAC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@ac-kit/format-cbor",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.2",
|
|
4
4
|
"description": "CBOR (RFC 8949) codec: a binary encoder and decoder including an incremental one, a diagnostic-notation lexer, parser and printer, and a JSON bridge.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"binary",
|
|
@@ -45,17 +45,17 @@
|
|
|
45
45
|
"prepack": "yarn build"
|
|
46
46
|
},
|
|
47
47
|
"dependencies": {
|
|
48
|
-
"@ac-kit/algo": "^0.
|
|
49
|
-
"@ac-kit/core": "^0.
|
|
50
|
-
"@ac-kit/format-core": "^0.1.
|
|
51
|
-
"@ac-kit/math-numbers": "^0.
|
|
48
|
+
"@ac-kit/algo": "^0.2.0",
|
|
49
|
+
"@ac-kit/core": "^0.3.0",
|
|
50
|
+
"@ac-kit/format-core": "^0.1.2",
|
|
51
|
+
"@ac-kit/math-numbers": "^0.2.0",
|
|
52
52
|
"@types/node": "^26.5.1",
|
|
53
53
|
"type-fest": "^5.8.0"
|
|
54
54
|
},
|
|
55
55
|
"devDependencies": {
|
|
56
56
|
"@ac-kit/tsconfig": "0.1.0",
|
|
57
57
|
"@ac-kit/typedoc-config": "0.1.0",
|
|
58
|
-
"@ac-kit/vitest-config": "0.1.
|
|
58
|
+
"@ac-kit/vitest-config": "0.1.1",
|
|
59
59
|
"@typescript/native": "typescript@7.0.2",
|
|
60
60
|
"rimraf": "6.1.3",
|
|
61
61
|
"typedoc": "0.28.20",
|