@o3co/ts.hocon 1.6.1 → 1.7.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/index.cjs +6 -3
- package/dist/index.js +6 -3
- package/dist/zod.cjs +6 -3
- package/dist/zod.js +6 -3
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -2974,9 +2974,8 @@ function renderHoconAsJSON(v) {
|
|
|
2974
2974
|
case "boolean":
|
|
2975
2975
|
return v.raw;
|
|
2976
2976
|
case "number": {
|
|
2977
|
-
const
|
|
2978
|
-
|
|
2979
|
-
return JSON.stringify(v.raw);
|
|
2977
|
+
const norm = normalizeLeadingZeroNumber(v.raw);
|
|
2978
|
+
return JSON_NUMBER_RE.test(norm) ? norm : JSON.stringify(v.raw);
|
|
2980
2979
|
}
|
|
2981
2980
|
case "string":
|
|
2982
2981
|
return JSON.stringify(v.raw);
|
|
@@ -2998,6 +2997,10 @@ function renderHoconAsJSON(v) {
|
|
|
2998
2997
|
}
|
|
2999
2998
|
throw new Error(`renderHoconAsJSON: unsupported value kind (unresolved placeholder?)`);
|
|
3000
2999
|
}
|
|
3000
|
+
var JSON_NUMBER_RE = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
|
|
3001
|
+
function normalizeLeadingZeroNumber(raw) {
|
|
3002
|
+
return raw.replace(/^([+-]?)0+(\d)/, "$1$2");
|
|
3003
|
+
}
|
|
3001
3004
|
|
|
3002
3005
|
// src/parse.ts
|
|
3003
3006
|
var fs = __toESM(require("fs"), 1);
|
package/dist/index.js
CHANGED
|
@@ -2921,9 +2921,8 @@ function renderHoconAsJSON(v) {
|
|
|
2921
2921
|
case "boolean":
|
|
2922
2922
|
return v.raw;
|
|
2923
2923
|
case "number": {
|
|
2924
|
-
const
|
|
2925
|
-
|
|
2926
|
-
return JSON.stringify(v.raw);
|
|
2924
|
+
const norm = normalizeLeadingZeroNumber(v.raw);
|
|
2925
|
+
return JSON_NUMBER_RE.test(norm) ? norm : JSON.stringify(v.raw);
|
|
2927
2926
|
}
|
|
2928
2927
|
case "string":
|
|
2929
2928
|
return JSON.stringify(v.raw);
|
|
@@ -2945,6 +2944,10 @@ function renderHoconAsJSON(v) {
|
|
|
2945
2944
|
}
|
|
2946
2945
|
throw new Error(`renderHoconAsJSON: unsupported value kind (unresolved placeholder?)`);
|
|
2947
2946
|
}
|
|
2947
|
+
var JSON_NUMBER_RE = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
|
|
2948
|
+
function normalizeLeadingZeroNumber(raw) {
|
|
2949
|
+
return raw.replace(/^([+-]?)0+(\d)/, "$1$2");
|
|
2950
|
+
}
|
|
2948
2951
|
|
|
2949
2952
|
// src/parse.ts
|
|
2950
2953
|
import * as fs from "fs";
|
package/dist/zod.cjs
CHANGED
|
@@ -2961,9 +2961,8 @@ function renderHoconAsJSON(v) {
|
|
|
2961
2961
|
case "boolean":
|
|
2962
2962
|
return v.raw;
|
|
2963
2963
|
case "number": {
|
|
2964
|
-
const
|
|
2965
|
-
|
|
2966
|
-
return JSON.stringify(v.raw);
|
|
2964
|
+
const norm = normalizeLeadingZeroNumber(v.raw);
|
|
2965
|
+
return JSON_NUMBER_RE.test(norm) ? norm : JSON.stringify(v.raw);
|
|
2967
2966
|
}
|
|
2968
2967
|
case "string":
|
|
2969
2968
|
return JSON.stringify(v.raw);
|
|
@@ -2985,6 +2984,10 @@ function renderHoconAsJSON(v) {
|
|
|
2985
2984
|
}
|
|
2986
2985
|
throw new Error(`renderHoconAsJSON: unsupported value kind (unresolved placeholder?)`);
|
|
2987
2986
|
}
|
|
2987
|
+
var JSON_NUMBER_RE = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
|
|
2988
|
+
function normalizeLeadingZeroNumber(raw) {
|
|
2989
|
+
return raw.replace(/^([+-]?)0+(\d)/, "$1$2");
|
|
2990
|
+
}
|
|
2988
2991
|
|
|
2989
2992
|
// src/parse.ts
|
|
2990
2993
|
function getEnv(opts) {
|
package/dist/zod.js
CHANGED
|
@@ -2921,9 +2921,8 @@ function renderHoconAsJSON(v) {
|
|
|
2921
2921
|
case "boolean":
|
|
2922
2922
|
return v.raw;
|
|
2923
2923
|
case "number": {
|
|
2924
|
-
const
|
|
2925
|
-
|
|
2926
|
-
return JSON.stringify(v.raw);
|
|
2924
|
+
const norm = normalizeLeadingZeroNumber(v.raw);
|
|
2925
|
+
return JSON_NUMBER_RE.test(norm) ? norm : JSON.stringify(v.raw);
|
|
2927
2926
|
}
|
|
2928
2927
|
case "string":
|
|
2929
2928
|
return JSON.stringify(v.raw);
|
|
@@ -2945,6 +2944,10 @@ function renderHoconAsJSON(v) {
|
|
|
2945
2944
|
}
|
|
2946
2945
|
throw new Error(`renderHoconAsJSON: unsupported value kind (unresolved placeholder?)`);
|
|
2947
2946
|
}
|
|
2947
|
+
var JSON_NUMBER_RE = /^-?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
|
|
2948
|
+
function normalizeLeadingZeroNumber(raw) {
|
|
2949
|
+
return raw.replace(/^([+-]?)0+(\d)/, "$1$2");
|
|
2950
|
+
}
|
|
2948
2951
|
|
|
2949
2952
|
// src/parse.ts
|
|
2950
2953
|
function getEnv(opts) {
|