diff --git a/package.json b/package.json index c38e504..d5f73bd 100644 --- a/package.json +++ b/package.json @@ -5,7 +5,7 @@ "main": "index.js", "type": "module", "scripts": { - "build": "deno build.ts --tagName 1.64.0 > ubo.js", + "build": "deno build.ts --tagName 1.64.1b4 > ubo.js", "test": "node --test" }, "author": { diff --git a/ubo.js b/ubo.js index c63ec0a..feac182 100644 --- a/ubo.js +++ b/ubo.js @@ -6115,7 +6115,8 @@ function safeSelf() { } function jsonlEditFn(jsonp, text = '') { const safe = safeSelf(); - const linesBefore = text.split(/\n+/); + const lineSeparator = /\r?\n/.exec(text)?.[0] || '\n'; + const linesBefore = text.split('\n'); const linesAfter = []; for ( const lineBefore of linesBefore ) { let obj; @@ -6128,9 +6129,10 @@ function jsonlEditFn(jsonp, text = '') { linesAfter.push(lineBefore); continue; } - linesAfter.push(JSONPath.toJSON(obj, safe.JSON_stringify)); + const lineAfter = safe.JSON_stringify(obj); + linesAfter.push(lineAfter); } - return linesAfter.join('\n'); + return linesAfter.join(lineSeparator); } class JSONPath { static create(query) { @@ -6812,7 +6814,8 @@ function safeSelf() { } function jsonlEditFn(jsonp, text = '') { const safe = safeSelf(); - const linesBefore = text.split(/\n+/); + const lineSeparator = /\r?\n/.exec(text)?.[0] || '\n'; + const linesBefore = text.split('\n'); const linesAfter = []; for ( const lineBefore of linesBefore ) { let obj; @@ -6825,9 +6828,10 @@ function jsonlEditFn(jsonp, text = '') { linesAfter.push(lineBefore); continue; } - linesAfter.push(JSONPath.toJSON(obj, safe.JSON_stringify)); + const lineAfter = safe.JSON_stringify(obj); + linesAfter.push(lineAfter); } - return linesAfter.join('\n'); + return linesAfter.join(lineSeparator); } class JSONPath { static create(query) { @@ -7589,7 +7593,8 @@ function safeSelf() { } function jsonlEditFn(jsonp, text = '') { const safe = safeSelf(); - const linesBefore = text.split(/\n+/); + const lineSeparator = /\r?\n/.exec(text)?.[0] || '\n'; + const linesBefore = text.split('\n'); const linesAfter = []; for ( const lineBefore of linesBefore ) { let obj; @@ -7602,9 +7607,10 @@ function jsonlEditFn(jsonp, text = '') { linesAfter.push(lineBefore); continue; } - linesAfter.push(JSONPath.toJSON(obj, safe.JSON_stringify)); + const lineAfter = safe.JSON_stringify(obj); + linesAfter.push(lineAfter); } - return linesAfter.join('\n'); + return linesAfter.join(lineSeparator); } class JSONPath { static create(query) { @@ -8374,7 +8380,8 @@ function safeSelf() { } function jsonlEditFn(jsonp, text = '') { const safe = safeSelf(); - const linesBefore = text.split(/\n+/); + const lineSeparator = /\r?\n/.exec(text)?.[0] || '\n'; + const linesBefore = text.split('\n'); const linesAfter = []; for ( const lineBefore of linesBefore ) { let obj; @@ -8387,9 +8394,10 @@ function jsonlEditFn(jsonp, text = '') { linesAfter.push(lineBefore); continue; } - linesAfter.push(JSONPath.toJSON(obj, safe.JSON_stringify)); + const lineAfter = safe.JSON_stringify(obj); + linesAfter.push(lineAfter); } - return linesAfter.join('\n'); + return linesAfter.join(lineSeparator); } class JSONPath { static create(query) {