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

xml2object

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

xml2object - npm Package Compare versions

Comparing version 0.1.0 to 0.1.1

test/error-test.js

11

lib/xml2object.js

@@ -143,3 +143,3 @@ /**

this.saxStream.on("error", function (e) {
this.emit('error', e);
self.emit('error', e);

@@ -160,7 +160,12 @@ // clear the error and resume

xml2object.prototype.start = function() {
// Can only start once and must have a stream
if(this._hasStarted || !this.inputStream) {
// Can only start once
if(this._hasStarted) {
return;
}
// Must have a stream to start
if(!this.inputStream) {
throw new Error('Missing parsing source');
}
this._hasStarted = true;

@@ -167,0 +172,0 @@

@@ -5,3 +5,3 @@ {

"description": "Simple XML to JavaScript Object Converter",
"version": "0.1.0",
"version": "0.1.1",
"homepage": "https://github.com/emberfeather/node-xml2object",

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

@@ -27,3 +27,3 @@ # Node.js xml2object

// Bind to the file end event to tell when the file is done being streamed
parser.on('end', function(name, obj) {
parser.on('end', function() {
console.log('Finished parsing xml!');

@@ -50,3 +50,3 @@ });

// Bind to the file end event to tell when the file is done being streamed
parser.on('end', function(name, obj) {
parser.on('end', function() {
console.log('Finished parsing xml!');

@@ -75,3 +75,3 @@ });

// Bind to the file end event to tell when the file is done being streamed
parser.on('end', function(name, obj) {
parser.on('end', function() {
console.log('Finished parsing xml!');

@@ -102,2 +102,6 @@ });

var parser = new xml2object([ 'animal' ]);
parser.source = 'myAnimals.xml';
### .saxStream

@@ -104,0 +108,0 @@

@@ -28,2 +28,15 @@ var fs = require('fs');

exports.testNoSource = function(test){
test.expect(1);
var parser = new xml2object(['cat']);
test.throws(function() {
// Starting without any source should throw an error
parser.start();
}, Error);
test.done();
};
exports.testSetter = function(test){

@@ -30,0 +43,0 @@ test.expect(3);

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