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

xml-js

Package Overview
Dependencies
Maintainers
1
Versions
49
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xml-js - npm Package Compare versions

Comparing version 1.5.0 to 1.5.1

15

lib/js2xml.js

@@ -18,2 +18,3 @@ var common = require('./common');

common.ensureFlagExists('fullTagEmptyElement', options);
common.ensureFlagExists('noQuotesForNativeAttributes', options);
common.ensureSpacesExists(options);

@@ -44,8 +45,9 @@ if (typeof options.spaces === 'number') {

}
var key, attr, result = '';
var key, attr, quote, result = '';
for (key in attributes) {
if (attributes.hasOwnProperty(key)) {
quote = options.noQuotesForNativeAttributes && typeof attributes[key] !== 'string' ? '' : '"';
attr = '' + attributes[key]; // ensure Number and Boolean are converted to String
result += (options.spaces && options.indentAttributes? writeIndentation(options, depth+1, false) : ' ')
result += key + '="' + attr.replace(/"/g, '"') + '"';
result += (options.spaces && options.indentAttributes? writeIndentation(options, depth+1, false) : ' ');
result += key + '=' + quote + attr.replace(/"/g, '"') + quote;
}

@@ -201,5 +203,12 @@ }

function writeElementCompact(element, name, options, depth, indent) {
if (typeof element === 'undefined' || element === null) {
return options.fullTagEmptyElement ? '<' + name + '></' + name + '>' : '<' + name + '/>';
}
var xml = '';
if (name) {
xml += '<' + name;
if (typeof element !== 'object') {
xml += '>' + writeText(element,options) + '</' + name + '>';
return xml;
}
if (element[options.attributesKey]) {

@@ -206,0 +215,0 @@ xml += writeAttributes(element[options.attributesKey], options, depth);

2

package.json
{
"name": "xml-js",
"version": "1.5.0",
"version": "1.5.1",
"description": "A convertor between XML text and Javascript object / JSON text.",

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

@@ -66,2 +66,3 @@ export interface ElementCompact {

fullTagEmptyElement?: boolean
noQuotesForNativeAttributes?: boolean
}

@@ -68,0 +69,0 @@

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