@jtml/core 0.1.0 → 0.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/dist/{chunk-SHDXMADE.mjs → chunk-OWN3QIRF.mjs} +11 -2
- package/dist/cli.js +11 -2
- package/dist/cli.mjs +1 -1
- package/dist/index.js +11 -2
- package/dist/index.mjs +1 -1
- package/package.json +1 -1
|
@@ -286,6 +286,9 @@ var JTMLEncoder = class {
|
|
|
286
286
|
return String(value);
|
|
287
287
|
}
|
|
288
288
|
if (typeof value === "string") {
|
|
289
|
+
if (value === "") {
|
|
290
|
+
return '""';
|
|
291
|
+
}
|
|
289
292
|
return value.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\n/g, "\\n");
|
|
290
293
|
}
|
|
291
294
|
if (Array.isArray(value)) {
|
|
@@ -449,7 +452,7 @@ var JTMLDecoder = class {
|
|
|
449
452
|
for (let i = 0; i < schema.fields.length; i++) {
|
|
450
453
|
const field = schema.fields[i];
|
|
451
454
|
const rawValue = values[i];
|
|
452
|
-
if (rawValue ===
|
|
455
|
+
if (rawValue === null) {
|
|
453
456
|
result[field.name] = null;
|
|
454
457
|
} else {
|
|
455
458
|
result[field.name] = this.decodeValue(rawValue, field.typeInfo.type);
|
|
@@ -493,9 +496,15 @@ var JTMLDecoder = class {
|
|
|
493
496
|
* Decode a single value
|
|
494
497
|
*/
|
|
495
498
|
decodeValue(value, type) {
|
|
496
|
-
if (value === void 0 || value ===
|
|
499
|
+
if (value === void 0 || value === null) {
|
|
500
|
+
return null;
|
|
501
|
+
}
|
|
502
|
+
if (value === "") {
|
|
497
503
|
return null;
|
|
498
504
|
}
|
|
505
|
+
if (value === '""') {
|
|
506
|
+
return "";
|
|
507
|
+
}
|
|
499
508
|
if (type === "b") {
|
|
500
509
|
return value === "1" || value === "true";
|
|
501
510
|
}
|
package/dist/cli.js
CHANGED
|
@@ -255,6 +255,9 @@ var JTMLEncoder = class {
|
|
|
255
255
|
return String(value);
|
|
256
256
|
}
|
|
257
257
|
if (typeof value === "string") {
|
|
258
|
+
if (value === "") {
|
|
259
|
+
return '""';
|
|
260
|
+
}
|
|
258
261
|
return value.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\n/g, "\\n");
|
|
259
262
|
}
|
|
260
263
|
if (Array.isArray(value)) {
|
|
@@ -398,7 +401,7 @@ var JTMLDecoder = class {
|
|
|
398
401
|
for (let i = 0; i < schema.fields.length; i++) {
|
|
399
402
|
const field = schema.fields[i];
|
|
400
403
|
const rawValue = values[i];
|
|
401
|
-
if (rawValue ===
|
|
404
|
+
if (rawValue === null) {
|
|
402
405
|
result[field.name] = null;
|
|
403
406
|
} else {
|
|
404
407
|
result[field.name] = this.decodeValue(rawValue, field.typeInfo.type);
|
|
@@ -442,9 +445,15 @@ var JTMLDecoder = class {
|
|
|
442
445
|
* Decode a single value
|
|
443
446
|
*/
|
|
444
447
|
decodeValue(value, type) {
|
|
445
|
-
if (value === void 0 || value ===
|
|
448
|
+
if (value === void 0 || value === null) {
|
|
449
|
+
return null;
|
|
450
|
+
}
|
|
451
|
+
if (value === "") {
|
|
446
452
|
return null;
|
|
447
453
|
}
|
|
454
|
+
if (value === '""') {
|
|
455
|
+
return "";
|
|
456
|
+
}
|
|
448
457
|
if (type === "b") {
|
|
449
458
|
return value === "1" || value === "true";
|
|
450
459
|
}
|
package/dist/cli.mjs
CHANGED
package/dist/index.js
CHANGED
|
@@ -338,6 +338,9 @@ var JTMLEncoder = class {
|
|
|
338
338
|
return String(value);
|
|
339
339
|
}
|
|
340
340
|
if (typeof value === "string") {
|
|
341
|
+
if (value === "") {
|
|
342
|
+
return '""';
|
|
343
|
+
}
|
|
341
344
|
return value.replace(/\\/g, "\\\\").replace(/\|/g, "\\|").replace(/\n/g, "\\n");
|
|
342
345
|
}
|
|
343
346
|
if (Array.isArray(value)) {
|
|
@@ -501,7 +504,7 @@ var JTMLDecoder = class {
|
|
|
501
504
|
for (let i = 0; i < schema.fields.length; i++) {
|
|
502
505
|
const field = schema.fields[i];
|
|
503
506
|
const rawValue = values[i];
|
|
504
|
-
if (rawValue ===
|
|
507
|
+
if (rawValue === null) {
|
|
505
508
|
result[field.name] = null;
|
|
506
509
|
} else {
|
|
507
510
|
result[field.name] = this.decodeValue(rawValue, field.typeInfo.type);
|
|
@@ -545,9 +548,15 @@ var JTMLDecoder = class {
|
|
|
545
548
|
* Decode a single value
|
|
546
549
|
*/
|
|
547
550
|
decodeValue(value, type) {
|
|
548
|
-
if (value === void 0 || value ===
|
|
551
|
+
if (value === void 0 || value === null) {
|
|
552
|
+
return null;
|
|
553
|
+
}
|
|
554
|
+
if (value === "") {
|
|
549
555
|
return null;
|
|
550
556
|
}
|
|
557
|
+
if (value === '""') {
|
|
558
|
+
return "";
|
|
559
|
+
}
|
|
551
560
|
if (type === "b") {
|
|
552
561
|
return value === "1" || value === "true";
|
|
553
562
|
}
|
package/dist/index.mjs
CHANGED
package/package.json
CHANGED