Comparing version 1.2.5 to 1.2.6
@@ -93,3 +93,3 @@ 'use strict'; | ||
} | ||
text = sql.substr(idx, closeIdx - idx + 1); | ||
text = sql.substring(idx, closeIdx + 1); | ||
if (text.indexOf(EOL) > 0) { | ||
@@ -133,3 +133,3 @@ throwError(PEC.multiLineQI); | ||
addSpace(); | ||
text = sql.substr(idx, closeIdx - idx + 1); | ||
text = sql.substring(idx, closeIdx + 1); | ||
const hasLB = text.indexOf(EOL) > 0; | ||
@@ -136,0 +136,0 @@ if (hasLB) { |
@@ -9,19 +9,10 @@ 'use strict'; | ||
function getEOL(text) { | ||
let idx = 0, unix = 0, windows = 0; | ||
while (idx < text.length) { | ||
idx = text.indexOf('\n', idx); | ||
if (idx === -1) { | ||
break; | ||
} | ||
if (idx > 0 && text[idx - 1] === '\r') { | ||
windows++; | ||
} else { | ||
unix++; | ||
} | ||
idx++; | ||
} | ||
if (unix === windows) { | ||
const m1 = text.match(/\r\n/g); | ||
const m2 = text.match(/\n/g); | ||
const w = m1 ? m1.length : 0; | ||
const u = m2 ? m2.length - w : 0; | ||
if (u === w) { | ||
return os.EOL; | ||
} | ||
return unix > windows ? '\n' : '\r\n'; | ||
return u > w ? '\n' : '\r\n'; | ||
} | ||
@@ -28,0 +19,0 @@ |
{ | ||
"name": "pg-minify", | ||
"version": "1.2.5", | ||
"version": "1.2.6", | ||
"description": "Minifies PostgreSQL scripts.", | ||
@@ -5,0 +5,0 @@ "main": "lib/index.js", |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
15014
308