Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

pg-minify

Package Overview
Dependencies
Maintainers
1
Versions
54
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

pg-minify - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

27

lib/parser.js

@@ -74,3 +74,12 @@ 'use strict';

}
result += sql.substr(idx, closeIdx - idx + 1).replace(regLB, '\\n');
addSpace();
var sub = sql.substr(idx, closeIdx - idx + 1);
if (sub.indexOf(EOL) > 0) {
var prev = idx ? sql[idx - 1] : '';
if (prev !== 'E' && prev !== 'e') {
result += 'E';
}
sub = sub.replace(regLB, '\\n');
}
result += sub;
idx = closeIdx;

@@ -80,2 +89,11 @@ continue;

addSpace();
result += s;
} while (++idx < len);
return result;
function addSpace() {
if (space) {

@@ -87,9 +105,4 @@ if (result.length) {

}
}
result += s;
} while (++idx < len);
return result;
function throwError(code, error) {

@@ -96,0 +109,0 @@ var position = getIndexPos(sql, idx, EOL);

{
"name": "pg-minify",
"version": "0.1.0",
"version": "0.1.1",
"description": "Minifies PostgreSQL scripts.",

@@ -5,0 +5,0 @@ "main": "lib/index.js",

@@ -65,4 +65,17 @@ 'use strict';

describe("multi-line text", function () {
it("must be returned empty", function () {
expect(minify("'" + LB + "'")).toBe("E'\\n'");
expect(minify("'" + LB + LB + "'")).toBe("E'\\n\\n'");
expect(minify("text '" + LB + "'")).toBe("text E'\\n'");
expect(minify("text e'" + LB + "'")).toBe("text e'\\n'");
expect(minify("e'" + LB + "'")).toBe("e'\\n'");
expect(minify("E'" + LB + "'")).toBe("E'\\n'");
});
});
describe("quotes in strings", function () {
it("must be ignored", function () {
expect(minify("text''")).toBe("text''");
expect(minify("text ''")).toBe("text ''");
expect(minify("''''")).toBe("''''");

@@ -69,0 +82,0 @@ expect(minify("''''''")).toBe("''''''");

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc