cborg 1.6.0 → 1.6.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.
@@ -52,10 +52,14 @@ function* tokensToDiagnostic(inp, width = 100) {
52
52
  if (!token.type.terminal) {
53
53
  switch (token.type.name) {
54
54
  case 'map':
55
- indent.push(token.value * 2);
55
+ if (token.value) {
56
+ indent.push(token.value * 2);
57
+ }
56
58
  break;
57
59
  case 'array':
58
- indent.push(token.value);
60
+ if (token.value) {
61
+ indent.push(token.value);
62
+ }
59
63
  break;
60
64
  case 'tag':
61
65
  indent.push(1);
@@ -47,10 +47,14 @@ function* tokensToDiagnostic(inp, width = 100) {
47
47
  if (!token.type.terminal) {
48
48
  switch (token.type.name) {
49
49
  case 'map':
50
- indent.push(token.value * 2);
50
+ if (token.value) {
51
+ indent.push(token.value * 2);
52
+ }
51
53
  break;
52
54
  case 'array':
53
- indent.push(token.value);
55
+ if (token.value) {
56
+ indent.push(token.value);
57
+ }
54
58
  break;
55
59
  case 'tag':
56
60
  indent.push(1);
package/lib/diagnostic.js CHANGED
@@ -70,10 +70,14 @@ function * tokensToDiagnostic (inp, width = 100) {
70
70
  if (!token.type.terminal) {
71
71
  switch (token.type.name) {
72
72
  case 'map':
73
- indent.push(token.value * 2)
73
+ if (token.value) {
74
+ indent.push(token.value * 2)
75
+ }
74
76
  break
75
77
  case 'array':
76
- indent.push(token.value)
78
+ if (token.value) {
79
+ indent.push(token.value)
80
+ }
77
81
  break
78
82
  // TODO: test tags .. somehow
79
83
  /* c8 ignore next 5 */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "cborg",
3
- "version": "1.6.0",
3
+ "version": "1.6.1",
4
4
  "description": "Fast CBOR with a focus on strictness",
5
5
  "main": "./cjs/cborg.js",
6
6
  "bin": {
@@ -1 +1 @@
1
- {"version":3,"file":"diagnostic.d.ts","sourceRoot":"","sources":["../../lib/diagnostic.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wCAHW,UAAU,gEA4FpB"}
1
+ {"version":3,"file":"diagnostic.d.ts","sourceRoot":"","sources":["../../lib/diagnostic.js"],"names":[],"mappings":"AAGA;;;GAGG;AACH,wCAHW,UAAU,gEAgGpB"}