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.1 to 0.1.2

12

lib/parser.js

@@ -23,3 +23,2 @@ 'use strict';

EOL = getEOL(sql), // End-Of-Line
regLB = new RegExp(EOL, 'g'),
space = false;

@@ -76,4 +75,4 @@

addSpace();
var sub = sql.substr(idx, closeIdx - idx + 1);
if (sub.indexOf(EOL) > 0) {
var text = sql.substr(idx, closeIdx - idx + 1);
if (text.indexOf(EOL) > 0) {
var prev = idx ? sql[idx - 1] : '';

@@ -83,5 +82,7 @@ if (prev !== 'E' && prev !== 'e') {

}
sub = sub.replace(regLB, '\\n');
text = text.split(EOL).map(function (m) {
return m.replace(/^\s+|\s+$/g, '');
}).join('\\n');
}
result += sub;
result += text;
idx = closeIdx;

@@ -92,3 +93,2 @@ continue;

addSpace();
result += s;

@@ -95,0 +95,0 @@

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

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

@@ -66,3 +66,3 @@ 'use strict';

describe("multi-line text", function () {
it("must be returned empty", function () {
it("must be returned with E", function () {
expect(minify("'" + LB + "'")).toBe("E'\\n'");

@@ -75,2 +75,8 @@ expect(minify("'" + LB + LB + "'")).toBe("E'\\n\\n'");

});
it("must truncate text correctly", function () {
expect(minify("' first " + LB + " last '")).toBe("E' first\\nlast '");
expect(minify("' first " + LB + " second " + LB + " third '")).toBe("E' first\\nsecond\\nthird '");
expect(minify("'\t first " + LB + "\t second \t" + LB + "\t third \t'")).toBe("E'\t first\\nsecond\\nthird \t'");
});
});

@@ -77,0 +83,0 @@

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