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

minify-xml

Package Overview
Dependencies
Maintainers
1
Versions
35
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

minify-xml - npm Package Compare versions

Comparing version 2.1.4 to 2.1.5

17

index.js

@@ -16,7 +16,14 @@ "use strict"; // we are overriding arguments, so this is important!

// character, simply checking for (?<=<[^>]*) would not do the trick if e.g. > is used inside of a tag attribute.
const emptyRegexp = new RegExp(), inTagPattern = /(?<=<[^\s>]+(?:\s+[^=\s>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\1)/;
const emptyRegexp = new RegExp(), inTagPattern = /(?<=<[^\s>]*(?:\s+[^=\s>]+\s*=\s*(?:"[^"]*"|'[^']*'))*\1)/;
function findAllMatchesInTags(xml, regexp, lookbehind, group) {
if (!(lookbehind instanceof RegExp)) {
group = lookbehind; lookbehind = emptyRegexp;
}
return findAllMatches(xml, new RegExp(inTagPattern.source.replace("\\1",
lookbehind.source) + regexp.source, "g"), group);
}
function replaceInTags(xml, regexp, lookbehind, replacement) {
if (!replacement) {
replacement = lookbehind;
lookbehind = emptyRegexp;
if (!(lookbehind instanceof RegExp)) {
replacement = lookbehind; lookbehind = emptyRegexp;
}

@@ -96,3 +103,3 @@

...findAllMatches(xml, /<([^<\s\/]+):/g, 1), // look for all tags with namespaces (limitation: might also include tags inside of CData, we ignore that for now)
...findAllMatches(xml, /<[^<\s>]+(?:(?:\s+(?:([^=\s>]+):)?[^=\s>]+)\s*=\s*(?:"[^"]*"|'[^']*'))*/g, 1) // look for all attributes with namespaces
...findAllMatchesInTags(xml, /(?:\s+(?:([^=\s>]+):[^=\s>]+))/, 1) // look for all attributes with namespaces
], unused = all.filter(ns => !used.includes(ns));

@@ -99,0 +106,0 @@

{
"name": "minify-xml",
"version": "2.1.4",
"version": "2.1.5",
"description": "Fast XML minifier / compressor / uglifier with a command-line",

@@ -19,12 +19,11 @@ "keywords": [

"scripts": {
"test": "node test.js"
"test": "ava"
},
"files": [
"cli.js",
"test.js"
"cli.js"
],
"engines": {
"node": ">=10"
"node": ">=10"
},
"author": {
"author": {
"name": "Kristian Kraljic",

@@ -47,3 +46,7 @@ "email": "kris@kra.lc",

"meow": "^7.0.1"
},
"devDependencies": {
"ava": "^3.13.0",
"glob": "^7.1.6"
}
}
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