smol-toml 1.4.1 → 1.4.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/dist/index.cjs +7 -1
- package/dist/util.js +7 -1
- package/package.json +1 -1
package/dist/index.cjs
CHANGED
|
@@ -69,6 +69,12 @@ ${codeblock}`, options);
|
|
|
69
69
|
};
|
|
70
70
|
|
|
71
71
|
// dist/util.js
|
|
72
|
+
function isEscaped(str, ptr) {
|
|
73
|
+
let i = 0;
|
|
74
|
+
while (str[ptr - ++i] === "\\")
|
|
75
|
+
;
|
|
76
|
+
return --i && i % 2;
|
|
77
|
+
}
|
|
72
78
|
function indexOfNewline(str, start = 0, end = str.length) {
|
|
73
79
|
let idx = str.indexOf("\n", start);
|
|
74
80
|
if (str[idx - 1] === "\r")
|
|
@@ -123,7 +129,7 @@ function getStringEnd(str, seek) {
|
|
|
123
129
|
seek += target.length - 1;
|
|
124
130
|
do
|
|
125
131
|
seek = str.indexOf(target, ++seek);
|
|
126
|
-
while (seek > -1 && first !== "'" &&
|
|
132
|
+
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
127
133
|
if (seek > -1) {
|
|
128
134
|
seek += target.length;
|
|
129
135
|
if (target.length > 1) {
|
package/dist/util.js
CHANGED
|
@@ -26,6 +26,12 @@
|
|
|
26
26
|
* OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE.
|
|
27
27
|
*/
|
|
28
28
|
import { TomlError } from './error.js';
|
|
29
|
+
function isEscaped(str, ptr) {
|
|
30
|
+
let i = 0;
|
|
31
|
+
while (str[ptr - ++i] === '\\')
|
|
32
|
+
;
|
|
33
|
+
return --i && (i % 2);
|
|
34
|
+
}
|
|
29
35
|
export function indexOfNewline(str, start = 0, end = str.length) {
|
|
30
36
|
let idx = str.indexOf('\n', start);
|
|
31
37
|
if (str[idx - 1] === '\r')
|
|
@@ -86,7 +92,7 @@ export function getStringEnd(str, seek) {
|
|
|
86
92
|
seek += target.length - 1;
|
|
87
93
|
do
|
|
88
94
|
seek = str.indexOf(target, ++seek);
|
|
89
|
-
while (seek > -1 && first !== "'" &&
|
|
95
|
+
while (seek > -1 && first !== "'" && isEscaped(str, seek));
|
|
90
96
|
if (seek > -1) {
|
|
91
97
|
seek += target.length;
|
|
92
98
|
if (target.length > 1) {
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "smol-toml",
|
|
3
3
|
"license": "BSD-3-Clause",
|
|
4
|
-
"version": "1.4.
|
|
4
|
+
"version": "1.4.2",
|
|
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",
|