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

dolmx

Package Overview
Dependencies
Maintainers
0
Versions
7
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

dolmx - npm Package Compare versions

Comparing version 1.1.1 to 1.1.2

49

dist/index.js

@@ -9,7 +9,8 @@ "use strict";

let pointer = result;
while (xmlChars && xmlChars.length) {
const current = xmlChars.shift();
let index = 0;
outer: while (index < xmlChars.length) {
const current = xmlChars[index];
if (current === '<') {
if (xmlChars[0] === '/') {
xmlChars.shift();
if (xmlChars[index + 1] === '/') {
index += 2;
const currentElementNameLength = pointer.name.length;

@@ -19,9 +20,11 @@ if (!currentElementNameLength) {

}
const nextCharList = xmlChars.splice(0, currentElementNameLength).join('');
const nextCharList = xmlChars.slice(index, index + currentElementNameLength).join('');
if (nextCharList !== pointer.name) {
(0, utils_1.error)('Element need close');
}
let next = xmlChars.shift();
index += currentElementNameLength;
let next = xmlChars[index];
while (next === ' ') {
next = xmlChars.shift();
index++;
next = xmlChars[index];
}

@@ -31,19 +34,26 @@ if (next !== '>') {

}
index++;
pointer = pointer.end();
continue outer;
}
else if (xmlChars[0] === '!' && xmlChars.slice(0, 8).join('') === '![CDATA[') {
xmlChars.splice(0, 8);
const valueIndex = xmlChars.findIndex((value, index) => {
return value === ']' && xmlChars[index + 1] === ']' && xmlChars[index + 2] === '>';
});
if (valueIndex === -1) {
else if (xmlChars[index + 1] === '!' && xmlChars.slice(index + 1, index + 9).join('') === '![CDATA[') {
index += 9;
let valueEndIndex = -1;
for (let start = index; start < xmlChars.length; start++) {
if (xmlChars[start] === ']' && xmlChars[start + 1] === ']' && xmlChars[start + 2] === '>') {
valueEndIndex = start;
break;
}
}
if (valueEndIndex === -1) {
(0, utils_1.error)('CDATA need close');
}
const cdata = xmlChars.splice(0, valueIndex).join('');
const cdata = xmlChars.slice(index, valueEndIndex).join('');
pointer.value(cdata, true);
xmlChars.splice(0, 3);
index = valueEndIndex + 3;
continue outer;
}
else {
if (xmlChars[0] === '?') {
xmlChars.shift();
if (xmlChars[index + 1] === '?') {
index++;
}

@@ -54,4 +64,4 @@ pointer = new element_1.Element(pointer);

else if (current === '/' || current === '?') {
if (xmlChars[0] === '>') {
xmlChars.shift();
if (xmlChars[index + 1] === '>') {
index++;
pointer = pointer.end();

@@ -80,2 +90,3 @@ }

}
index++;
}

@@ -82,0 +93,0 @@ return result.toObject();

{
"name": "dolmx",
"version": "1.1.1",
"version": "1.1.2",
"description": "mini xml parser",

@@ -5,0 +5,0 @@ "repository": {

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