xml-but-prettier
Advanced tools
Comparing version 1.0.0 to 1.0.1
@@ -65,4 +65,8 @@ 'use strict'; | ||
return rawResult.filter(function (val, i) { | ||
return indicesToRemove.indexOf(i) === -1; | ||
indicesToRemove.forEach(function (idx) { | ||
return rawResult[idx] = null; | ||
}); | ||
return rawResult.filter(function (val) { | ||
return !!val; | ||
}).join('\n'); | ||
@@ -69,0 +73,0 @@ }; |
{ | ||
"name": "xml-but-prettier", | ||
"version": "1.0.0", | ||
"version": "1.0.1", | ||
"title": "XML Beautifier", | ||
@@ -5,0 +5,0 @@ "description": "Beautifies XML documents by putting each tag and text node on their own line and correctly indents everything", |
@@ -32,3 +32,3 @@ # XML, But Prettier | ||
#### Options | ||
- `indentor`: a custom string to divide lines by | ||
- `indentor`: a custom string to use for indenting things | ||
- `textNodesOnSameLine`: compresses text nodes onto the same line as their containing tags | ||
@@ -35,0 +35,0 @@ |
@@ -45,4 +45,6 @@ 'use strict'; | ||
indicesToRemove.forEach(idx => rawResult[idx] = null) | ||
return rawResult | ||
.filter((val, i) => indicesToRemove.indexOf(i) === -1) | ||
.filter(val => !!val) | ||
.join('\n') | ||
@@ -49,0 +51,0 @@ }; |
@@ -83,2 +83,12 @@ const beautify = require('../src/index'); | ||
const endTime = Date.now() | ||
expect(endTime - startTime).toBeLessThan(2500) | ||
}) | ||
it("should process 2MB of XML quickly with `textNodesOnSameLine`", () => { | ||
const xml = fs.readFileSync(__dirname + '/huge.xml', 'utf8') | ||
const startTime = Date.now() | ||
beautify(xml, { | ||
textNodesOnSameLine: true | ||
}) | ||
const endTime = Date.now() | ||
expect(endTime - startTime).toBeLessThan(5000) | ||
@@ -85,0 +95,0 @@ }) |
Sorry, the diff of this file is not supported yet
AI detected anomaly
Supply chain riskAI has identified unusual behaviors that may pose a security risk.
Found 1 instance in 1 package
2306912
237
2