Socket
Socket
Sign inDemoInstall

html-minifier

Package Overview
Dependencies
Maintainers
2
Versions
80
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

html-minifier - npm Package Compare versions

Comparing version 3.5.4 to 3.5.5

4

package.json
{
"name": "html-minifier",
"description": "Highly configurable, well-tested, JavaScript-based HTML minifier.",
"version": "3.5.4",
"version": "3.5.5",
"keywords": [

@@ -69,3 +69,3 @@ "cli",

"grunt-browserify": "5.2.x",
"grunt-contrib-uglify": "3.0.x",
"grunt-contrib-uglify": "3.1.x",
"gruntify-eslint": "4.0.x",

@@ -72,0 +72,0 @@ "phantomjs-prebuilt": "2.1.x",

@@ -26,13 +26,13 @@ # HTMLMinifier

| [Google](https://www.google.com/) | 45 | **42** | 45 | 47 | 45 |
| [HTMLMinifier](https://github.com/kangax/html-minifier) | 131 | **102** | 110 | 114 | 109 |
| [Amazon](https://www.amazon.co.uk/) | 204 | **171** | 195 | 199 | n/a |
| [New York Times](https://www.nytimes.com/) | 233 | **159** | 182 | 178 | 166 |
| [Stack Overflow](https://stackoverflow.com/) | 246 | **193** | 202 | 210 | 199 |
| [HTMLMinifier](https://github.com/kangax/html-minifier) | 133 | **104** | 112 | 116 | 111 |
| [Amazon](https://www.amazon.co.uk/) | 203 | **171** | 195 | 199 | n/a |
| [New York Times](https://www.nytimes.com/) | 233 | **158** | 182 | 178 | 166 |
| [Stack Overflow](https://stackoverflow.com/) | 239 | **186** | 195 | 203 | 192 |
| [Bootstrap CSS](https://getbootstrap.com/docs/3.3/css/) | 272 | **260** | 269 | 229 | 269 |
| [Twitter](https://twitter.com/) | 291 | **216** | 257 | 280 | 257 |
| [BBC](https://www.bbc.co.uk/) | 311 | **256** | 302 | 310 | 294 |
| [BBC](https://www.bbc.co.uk/) | 279 | **229** | 271 | 278 | 262 |
| [Twitter](https://twitter.com/) | 298 | **223** | 263 | 287 | 263 |
| [Wikipedia](https://en.wikipedia.org/wiki/President_of_the_United_States) | 469 | **437** | 453 | 468 | 453 |
| [NBC](https://www.nbc.com/) | 663 | **626** | 659 | 663 | n/a |
| [NBC](https://www.nbc.com/) | 665 | **627** | 661 | 664 | n/a |
| [Eloquent Javascript](https://eloquentjavascript.net/1st_edition/print.html) | 870 | **815** | 840 | 864 | n/a |
| [ES6 table](https://kangax.github.io/compat-table/es6/) | 4227 | **3585** | 3998 | n/a | n/a |
| [ES6 table](https://kangax.github.io/compat-table/es6/) | 4228 | **3586** | 3999 | n/a | n/a |
| [ES6 draft](https://tc39.github.io/ecma262/) | 5701 | **5087** | 5236 | n/a | n/a |

@@ -39,0 +39,0 @@

@@ -11,16 +11,12 @@ 'use strict';

var trimWhitespace = String.prototype.trim ? function(str) {
function trimWhitespace(str) {
if (typeof str !== 'string') {
return str;
}
return str.trim();
} : function(str) {
if (typeof str !== 'string') {
return str;
}
return str.replace(/^\s+/, '').replace(/\s+$/, '');
};
return str.replace(/^[ \n\r\t\f]+/, '').replace(/[ \n\r\t\f]+$/, '');
}
function collapseWhitespaceAll(str) {
return str && str.replace(/\s+/g, function(spaces) {
// Non-breaking space is specifically handled inside the replacer function here:
return str && str.replace(/[ \n\r\t\f\xA0]+/g, function(spaces) {
return spaces === '\t' ? '\t' : spaces.replace(/(^|\xA0+)[^\xA0]+/g, '$1 ');

@@ -34,6 +30,6 @@ });

if (options.preserveLineBreaks) {
str = str.replace(/^\s*?[\n\r]\s*/, function() {
str = str.replace(/^[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*/, function() {
lineBreakBefore = '\n';
return '';
}).replace(/\s*?[\n\r]\s*$/, function() {
}).replace(/[ \n\r\t\f]*?[\n\r][ \n\r\t\f]*$/, function() {
lineBreakAfter = '\n';

@@ -45,3 +41,4 @@ return '';

if (trimLeft) {
str = str.replace(/^\s+/, function(spaces) {
// Non-breaking space is specifically handled inside the replacer function here:
str = str.replace(/^[ \n\r\t\f\xA0]+/, function(spaces) {
var conservative = !lineBreakBefore && options.conservativeCollapse;

@@ -56,3 +53,4 @@ if (conservative && spaces === '\t') {

if (trimRight) {
str = str.replace(/\s+$/, function(spaces) {
// Non-breaking space is specifically handled inside the replacer function here:
str = str.replace(/[ \n\r\t\f\xA0]+$/, function(spaces) {
var conservative = !lineBreakAfter && options.conservativeCollapse;

@@ -1260,3 +1258,3 @@ if (conservative && spaces === '\t') {

conservativeCollapse: !options.trimCustomFragments
}, /^\s/.test(chunk), /\s$/.test(chunk));
}, /^[ \n\r\t\f]/.test(chunk), /[ \n\r\t\f]$/.test(chunk));
}

@@ -1263,0 +1261,0 @@ return chunk;

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