Socket
Socket
Sign inDemoInstall

object-to-xml

Package Overview
Dependencies
3
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

Comparing version 1.1.0 to 2.0.0

test.js

22

index.js

@@ -1,3 +0,4 @@

var sanitizer = require('sanitizer')
, map = require('dank-map')
var sanitizer = require('sanitizer');
var map = require('dank-map');
var each = require('dank-each');
;

@@ -9,5 +10,9 @@

map(obj, function (key, value) {
each(obj, function (key, value) {
var attributes = '';
if (key === '@') {
return;
}
if (value && (value.hasOwnProperty('@') || value.hasOwnProperty('#'))) {

@@ -23,7 +28,14 @@ attributes = map(value['@'], function (key, value) {

value = value['#'];
if (value['#']) {
value = value['#'];
}
else if (Object.keys(value).length === 1 && value.hasOwnProperty('@')) {
//if the only property this object has is '@', then set value to null
//so it will generate <key prop="" prop2="" />
value = null;
}
}
if (Array.isArray(value)) {
map(value, function (ix, value) {
each(value, function (ix, value) {
var tmp = {};

@@ -30,0 +42,0 @@

{
"name": "object-to-xml",
"version": "1.1.0",
"version": "2.0.0",
"description": "Convert any object to XML",
"main": "index.js",
"scripts": {
"test": "nodeunit test/test.js"
"test": "tape test.js"
},

@@ -24,2 +24,3 @@ "repository": {

"dependencies": {
"dank-each": "^1.0.0",
"dank-map": "~0.1.0",

@@ -29,4 +30,4 @@ "sanitizer": "0.1.3"

"devDependencies": {
"nodeunit": "^0.9.1"
"tape": "^4.9.1"
}
}
SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc