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

xmlbuilder2

Package Overview
Dependencies
Maintainers
1
Versions
46
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xmlbuilder2 - npm Package Compare versions

Comparing version 1.1.0 to 1.1.1

lib/writers/base/PreSerializer.d.ts

3

lib/builder/interfaces.d.ts

@@ -272,3 +272,4 @@ import { Node, Document } from "@oozcitak/dom/lib/dom/interfaces";

/**
* Determines the maximum column width. Defaults to `80`.
* Wraps attributes to the next line if the column width exceeds the given
* value. Defaults to `0` which disables attribute wrapping.
*/

@@ -275,0 +276,0 @@ width?: number;

@@ -30,4 +30,3 @@ "use strict";

newline: '\n',
offset: 0,
noDoubleEncoding: false
offset: 0
});

@@ -34,0 +33,0 @@ // convert to object

@@ -5,4 +5,3 @@ "use strict";

const interfaces_1 = require("@oozcitak/dom/lib/dom/interfaces");
const PreSerializerNS_1 = require("./base/PreSerializerNS");
const PreSerializerNoNS_1 = require("./base/PreSerializerNoNS");
const PreSerializer_1 = require("./base/PreSerializer");
/**

@@ -34,4 +33,3 @@ * Serializes XML nodes into objects and arrays.

let listRegister = [currentList];
const pre = node._nodeDocument === undefined || node._nodeDocument._hasNamespaces ?
new PreSerializerNS_1.PreSerializerNS() : new PreSerializerNoNS_1.PreSerializerNoNS();
const pre = new PreSerializer_1.PreSerializer();
pre.setCallbacks({

@@ -38,0 +36,0 @@ beginElement: (name) => {

@@ -12,2 +12,3 @@ import { StringWriterOptions, XMLBuilderOptions } from "../builder/interfaces";

private _indentation;
private _lengthToLastNewline;
/**

@@ -14,0 +15,0 @@ * Initializes a new instance of `StringWriterImpl`.

@@ -5,4 +5,3 @@ "use strict";

const interfaces_1 = require("@oozcitak/dom/lib/dom/interfaces");
const PreSerializerNS_1 = require("./base/PreSerializerNS");
const PreSerializerNoNS_1 = require("./base/PreSerializerNoNS");
const PreSerializer_1 = require("./base/PreSerializer");
const util_2 = require("@oozcitak/dom/lib/util");

@@ -20,2 +19,3 @@ /**

this._indentation = {};
this._lengthToLastNewline = 0;
this._builderOptions = builderOptions;

@@ -38,11 +38,9 @@ }

offset: 0,
width: 80,
width: 0,
allowEmptyTags: false,
indentTextOnlyNodes: false,
spaceBeforeSlash: false,
noDoubleEncoding: false
spaceBeforeSlash: false
});
this._refs = { suppressPretty: false, emptyNode: false, markup: "" };
this._pre = node._nodeDocument === undefined || node._nodeDocument._hasNamespaces ?
new PreSerializerNS_1.PreSerializerNS() : new PreSerializerNoNS_1.PreSerializerNoNS();
this._pre = new PreSerializer_1.PreSerializer();
this._pre.setCallbacks({

@@ -121,3 +119,9 @@ docType: this._docType.bind(this),

while (childNode) {
if (!util_2.Guard.isTextNode(childNode)) {
if (util_2.Guard.isExclusiveTextNode(childNode)) {
textCount++;
}
else if (util_2.Guard.isCDATASectionNode(childNode)) {
cdataCount++;
}
else {
textOnlyNode = false;

@@ -127,11 +131,5 @@ emptyNode = false;

}
else if (childNode.data !== '') {
if (childNode.data !== '') {
emptyNode = false;
}
if (util_2.Guard.isCDATASectionNode(childNode)) {
cdataCount++;
}
else if (util_2.Guard.isExclusiveTextNode(childNode)) {
textCount++;
}
childNode = childNode.nextSibling;

@@ -167,3 +165,12 @@ }

_attribute(name, value) {
this._refs.markup += " " + name + "=\"" + value + "\"";
const str = name + "=\"" + value + "\"";
if (this._options.prettyPrint && this._options.width > 0 &&
this._refs.markup.length - this._lengthToLastNewline + 1 + str.length > this._options.width) {
this._endLine();
this._beginLine();
this._refs.markup += this._indent(1) + str;
}
else {
this._refs.markup += " " + str;
}
}

@@ -222,2 +229,3 @@ /**

this._refs.markup += this._options.newline;
this._lengthToLastNewline = this._refs.markup.length;
}

@@ -224,0 +232,0 @@ }

{
"name": "xmlbuilder2",
"version": "1.1.0",
"version": "1.1.1",
"keywords": [

@@ -60,8 +60,9 @@ "xml",

"scripts": {
"compile": "rm -rf ./lib && tsc --version && tsc",
"test": "npm run compile && jest --coverage",
"perf": "npm run compile && ts-node ./perf/perf.ts",
"prof-serialize": "npm run compile && rm -f isolate-*-v8.log && node --prof ./perf/prof-serialize.js && find . -name isolate-*-v8.log -exec mv {} isolate-v8.log ; && node --prof-process isolate-v8.log > isolate-serialize.log && rm isolate-v8.log",
"publish-public": "npm run test && npm publish"
"pretest": "rm -rf ./lib && tsc --version && tsc",
"test": "jest --coverage",
"perf": "npm run pretest && ts-node ./perf/perf.ts",
"prof-serialize": "npm run pretest && rm -f isolate-*-v8.log && node --prof ./perf/prof-serialize.js && find . -name isolate-*-v8.log -exec mv {} isolate-v8.log ; && node --prof-process isolate-v8.log > isolate-serialize.log && rm isolate-v8.log",
"prepublish": "npm run test",
"postpublish": "git push --all && git push --tags"
}
}

@@ -105,4 +105,28 @@ # xmlbuilder2

```
___
You can convert between formats in one go with the `convert` function:
```js
const { convert } = require('xmlbuilder2');
const xmlStr = '<root att="val"><foo><bar>foobar</bar></foo></root>';
const obj = convert(xmlStr, { format: "object" });
console.log(obj);
```
```js
{
root: {
'@att': 'val',
foo: {
bar: 'foobar'
}
}
}
```
___
If you need to do some processing:

@@ -140,3 +164,5 @@

### Documentation:
See the [wiki](https://github.com/oozcitak/xmlbuilder2/wiki) for details.

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

Sorry, the diff of this file is not supported yet

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