smol-toml 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.
package/dist/index.cjs CHANGED
@@ -99,9 +99,14 @@ function skipComment(str, ptr) {
99
99
  }
100
100
  function skipVoid(str, ptr, banNewLines, banComments) {
101
101
  let c;
102
- while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
103
- ptr++;
104
- return banComments || c !== "#" ? ptr : skipVoid(str, skipComment(str, ptr), banNewLines);
102
+ while (1) {
103
+ while ((c = str[ptr]) === " " || c === " " || !banNewLines && (c === "\n" || c === "\r" && str[ptr + 1] === "\n"))
104
+ ptr++;
105
+ if (banComments || c !== "#")
106
+ break;
107
+ ptr = skipComment(str, ptr);
108
+ }
109
+ return ptr;
105
110
  }
106
111
  function skipUntil(str, ptr, sep, end, banNewLines = false) {
107
112
  if (!end) {
package/dist/util.js CHANGED
@@ -56,11 +56,16 @@ export function skipComment(str, ptr) {
56
56
  }
57
57
  export function skipVoid(str, ptr, banNewLines, banComments) {
58
58
  let c;
59
- while ((c = str[ptr]) === ' ' || c === '\t' || (!banNewLines && (c === '\n' || c === '\r' && str[ptr + 1] === '\n')))
60
- ptr++;
61
- return banComments || c !== '#'
62
- ? ptr
63
- : skipVoid(str, skipComment(str, ptr), banNewLines);
59
+ while (1) {
60
+ while ((c = str[ptr]) === ' ' || c === '\t' || (!banNewLines && (c === '\n' || c === '\r' && str[ptr + 1] === '\n')))
61
+ ptr++;
62
+ // Tucking the return statement here would save 5 characters >:)
63
+ // But TypeScript fails to detect there is no way to exit the loop so it complains about the lack of final return
64
+ if (banComments || c !== '#')
65
+ break;
66
+ ptr = skipComment(str, ptr);
67
+ }
68
+ return ptr;
64
69
  }
65
70
  export function skipUntil(str, ptr, sep, end, banNewLines = false) {
66
71
  if (!end) {
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "smol-toml",
3
3
  "license": "BSD-3-Clause",
4
- "version": "1.6.0",
4
+ "version": "1.6.1",
5
5
  "description": "A small, fast, and correct TOML parser/serializer",
6
6
  "author": "Cynthia <cyyynthia@borkenware.com>",
7
7
  "repository": "github:squirrelchat/smol-toml",
@@ -21,13 +21,13 @@
21
21
  "@ltd/j-toml": "^1.38.0",
22
22
  "@tsconfig/node-lts": "^24.0.0",
23
23
  "@tsconfig/strictest": "^2.0.8",
24
- "@types/node": "^25.0.3",
25
- "@vitest/ui": "^4.0.16",
26
- "esbuild": "^0.27.2",
24
+ "@types/node": "^25.5.0",
25
+ "@vitest/ui": "^4.1.1",
26
+ "esbuild": "^0.27.4",
27
27
  "fast-toml": "^0.5.4",
28
28
  "pin-github-action": "^3.4.0",
29
29
  "typescript": "^5.9.3",
30
- "vitest": "^4.0.16"
30
+ "vitest": "^4.1.1"
31
31
  },
32
32
  "main": "./dist/index.cjs",
33
33
  "module": "./dist/index.js",