NPM Dependencies UPDATE
This commit is contained in:
1 parent
20c29bb4d6
commit
a9bfe7a413
599 files changed
+12369
-51423
No files matched your search
+6
@@ -94,6 +94,12 @@ fs.readFile __dirname + '/foo.xml', (err, data) ->
|
||||
console.log 'Done.'
|
||||
```
|
||||
|
||||
But what happens if you forget the `new` keyword to create a new `Parser`? In
|
||||
the middle of a nightly coding session, it might get lost, after all. Worry
|
||||
not, we got you covered! Starting with 0.2.8 you can also leave it out, in
|
||||
which case `xml2js` will helpfully add it for you, no bad surprises and
|
||||
inexplicable bugs!
|
||||
|
||||
"Traditional" usage
|
||||
-------------------
|
||||
|
||||
|
||||
+29
-20
@@ -1,9 +1,9 @@
|
||||
// Generated by CoffeeScript 1.6.1
|
||||
// Generated by CoffeeScript 1.6.3
|
||||
(function() {
|
||||
var events, isEmpty, sax,
|
||||
__hasProp = {}.hasOwnProperty,
|
||||
__extends = function(child, parent) { for (var key in parent) { if (__hasProp.call(parent, key)) child[key] = parent[key]; } function ctor() { this.constructor = child; } ctor.prototype = parent.prototype; child.prototype = new ctor(); child.__super__ = parent.prototype; return child; },
|
||||
_this = this;
|
||||
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
|
||||
|
||||
sax = require('sax');
|
||||
|
||||
@@ -55,7 +55,6 @@
|
||||
};
|
||||
|
||||
exports.ValidationError = (function(_super) {
|
||||
|
||||
__extends(ValidationError, _super);
|
||||
|
||||
function ValidationError(message) {
|
||||
@@ -67,18 +66,15 @@
|
||||
})(Error);
|
||||
|
||||
exports.Parser = (function(_super) {
|
||||
|
||||
__extends(Parser, _super);
|
||||
|
||||
function Parser(opts) {
|
||||
var key, value, _ref,
|
||||
_this = this;
|
||||
this.parseString = function(str, cb) {
|
||||
return Parser.prototype.parseString.apply(_this, arguments);
|
||||
};
|
||||
this.reset = function() {
|
||||
return Parser.prototype.reset.apply(_this, arguments);
|
||||
};
|
||||
this.parseString = __bind(this.parseString, this);
|
||||
this.reset = __bind(this.reset, this);
|
||||
var key, value, _ref;
|
||||
if (!(this instanceof exports.Parser)) {
|
||||
return new exports.Parser(opts);
|
||||
}
|
||||
this.options = {};
|
||||
_ref = exports.defaults["0.2"];
|
||||
for (key in _ref) {
|
||||
@@ -98,7 +94,7 @@
|
||||
}
|
||||
|
||||
Parser.prototype.reset = function() {
|
||||
var attrkey, charkey, err, stack,
|
||||
var attrkey, charkey, err, ontext, stack,
|
||||
_this = this;
|
||||
this.removeAllListeners();
|
||||
this.saxParser = sax.parser(this.options.strict, {
|
||||
@@ -146,12 +142,15 @@
|
||||
return stack.push(obj);
|
||||
};
|
||||
this.saxParser.onclosetag = function() {
|
||||
var node, nodeName, obj, old, s, xpath;
|
||||
var cdata, emptyStr, node, nodeName, obj, old, s, xpath;
|
||||
obj = stack.pop();
|
||||
nodeName = obj["#name"];
|
||||
delete obj["#name"];
|
||||
cdata = obj.cdata;
|
||||
delete obj.cdata;
|
||||
s = stack[stack.length - 1];
|
||||
if (obj[charkey].match(/^\s*$/)) {
|
||||
if (obj[charkey].match(/^\s*$/) && !cdata) {
|
||||
emptyStr = obj[charkey];
|
||||
delete obj[charkey];
|
||||
} else {
|
||||
if (_this.options.trim) {
|
||||
@@ -164,8 +163,8 @@
|
||||
obj = obj[charkey];
|
||||
}
|
||||
}
|
||||
if ((isEmpty(obj)) && stack.length > 0) {
|
||||
obj = _this.options.emptyTag !== void 0 ? _this.options.emptyTag : '';
|
||||
if (isEmpty(obj)) {
|
||||
obj = _this.options.emptyTag !== void 0 ? _this.options.emptyTag : emptyStr;
|
||||
}
|
||||
if (_this.options.validator != null) {
|
||||
xpath = "/" + ((function() {
|
||||
@@ -179,7 +178,8 @@
|
||||
})()).concat(nodeName).join("/");
|
||||
try {
|
||||
obj = _this.options.validator(xpath, s && s[nodeName], obj);
|
||||
} catch (err) {
|
||||
} catch (_error) {
|
||||
err = _error;
|
||||
_this.emit("error", err);
|
||||
}
|
||||
}
|
||||
@@ -225,11 +225,20 @@
|
||||
return _this.emit("end", _this.resultObject);
|
||||
}
|
||||
};
|
||||
return this.saxParser.ontext = this.saxParser.oncdata = function(text) {
|
||||
ontext = function(text) {
|
||||
var s;
|
||||
s = stack[stack.length - 1];
|
||||
if (s) {
|
||||
return s[charkey] += text;
|
||||
s[charkey] += text;
|
||||
return s;
|
||||
}
|
||||
};
|
||||
this.saxParser.ontext = ontext;
|
||||
return this.saxParser.oncdata = function(text) {
|
||||
var s;
|
||||
s = ontext(text);
|
||||
if (s) {
|
||||
return s.cdata = true;
|
||||
}
|
||||
};
|
||||
};
|
||||
|
||||
+20
-18
@@ -1,32 +1,27 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"xml2js@0.2.7",
|
||||
"C:\\Users\\Luis\\source\\repos\\AACloud"
|
||||
]
|
||||
],
|
||||
"_from": "xml2js@0.2.7",
|
||||
"_id": "xml2js@0.2.7",
|
||||
"_from": "xml2js@0.2.8",
|
||||
"_id": "xml2js@0.2.8",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha1-GDhRi7AXQcrgh4urSRXklMMjBq8=",
|
||||
"_integrity": "sha1-m4FpCTFjH/CdGVdUn69U9PmAs8I=",
|
||||
"_location": "/xml2js",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "xml2js@0.2.7",
|
||||
"raw": "xml2js@0.2.8",
|
||||
"name": "xml2js",
|
||||
"escapedName": "xml2js",
|
||||
"rawSpec": "0.2.7",
|
||||
"rawSpec": "0.2.8",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "0.2.7"
|
||||
"fetchSpec": "0.2.8"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/azure-storage"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.2.7.tgz",
|
||||
"_spec": "0.2.7",
|
||||
"_where": "C:\\Users\\Luis\\source\\repos\\AACloud",
|
||||
"_resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.2.8.tgz",
|
||||
"_shasum": "9b81690931631ff09d1957549faf54f4f980b3c2",
|
||||
"_spec": "xml2js@0.2.8",
|
||||
"_where": "C:\\Users\\Luis\\source\\repos\\AACloud\\node_modules\\azure-storage",
|
||||
"author": {
|
||||
"name": "Marek Kubica",
|
||||
"email": "marek@xivilization.net",
|
||||
@@ -35,6 +30,7 @@
|
||||
"bugs": {
|
||||
"url": "https://github.com/Leonidas-from-XIV/node-xml2js/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"contributors": [
|
||||
{
|
||||
"name": "maqr",
|
||||
@@ -112,14 +108,20 @@
|
||||
"name": "Chris Tavares",
|
||||
"email": "ctavares@microsoft.com",
|
||||
"url": "https://github.com/christav"
|
||||
},
|
||||
{
|
||||
"name": "Frank Xu",
|
||||
"email": "yyfrankyy@gmail.com",
|
||||
"url": "http://f2e.us/"
|
||||
}
|
||||
],
|
||||
"dependencies": {
|
||||
"sax": "0.5.2"
|
||||
"sax": "0.5.x"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Simple XML to JavaScript object converter.",
|
||||
"devDependencies": {
|
||||
"coffee-script": ">=1.6.1",
|
||||
"coffee-script": ">=1.6.3",
|
||||
"docco": ">=0.6.2",
|
||||
"zap": ">=0.2.5"
|
||||
},
|
||||
@@ -140,5 +142,5 @@
|
||||
"scripts": {
|
||||
"test": "zap"
|
||||
},
|
||||
"version": "0.2.7"
|
||||
"version": "0.2.8"
|
||||
}
|
||||
Reference in new issue
Block a user