Logs Automatically purges themselves

This commit is contained in:
Luis Fernando Molina committed 2018-03-17 17:04:07 +01:00
1 parent fda24f934c
commit a42174b233
632 files changed
+19952 -20039

No files matched your search

-6
View File
@@ -94,12 +94,6 @@ 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
-------------------
+20 -29
View File
@@ -1,9 +1,9 @@
// Generated by CoffeeScript 1.6.3
// Generated by CoffeeScript 1.6.1
(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; },
__bind = function(fn, me){ return function(){ return fn.apply(me, arguments); }; };
_this = this;
sax = require('sax');
@@ -55,6 +55,7 @@
};
exports.ValidationError = (function(_super) {
__extends(ValidationError, _super);
function ValidationError(message) {
@@ -66,15 +67,18 @@
})(Error);
exports.Parser = (function(_super) {
__extends(Parser, _super);
function Parser(opts) {
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);
}
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.options = {};
_ref = exports.defaults["0.2"];
for (key in _ref) {
@@ -94,7 +98,7 @@
}
Parser.prototype.reset = function() {
var attrkey, charkey, err, ontext, stack,
var attrkey, charkey, err, stack,
_this = this;
this.removeAllListeners();
this.saxParser = sax.parser(this.options.strict, {
@@ -142,15 +146,12 @@
return stack.push(obj);
};
this.saxParser.onclosetag = function() {
var cdata, emptyStr, node, nodeName, obj, old, s, xpath;
var 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*$/) && !cdata) {
emptyStr = obj[charkey];
if (obj[charkey].match(/^\s*$/)) {
delete obj[charkey];
} else {
if (_this.options.trim) {
@@ -163,8 +164,8 @@
obj = obj[charkey];
}
}
if (isEmpty(obj)) {
obj = _this.options.emptyTag !== void 0 ? _this.options.emptyTag : emptyStr;
if ((isEmpty(obj)) && stack.length > 0) {
obj = _this.options.emptyTag !== void 0 ? _this.options.emptyTag : '';
}
if (_this.options.validator != null) {
xpath = "/" + ((function() {
@@ -178,8 +179,7 @@
})()).concat(nodeName).join("/");
try {
obj = _this.options.validator(xpath, s && s[nodeName], obj);
} catch (_error) {
err = _error;
} catch (err) {
_this.emit("error", err);
}
}
@@ -225,20 +225,11 @@
return _this.emit("end", _this.resultObject);
}
};
ontext = function(text) {
return this.saxParser.ontext = this.saxParser.oncdata = function(text) {
var s;
s = stack[stack.length - 1];
if (s) {
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;
return s[charkey] += text;
}
};
};
+29 -50
View File
@@ -1,54 +1,50 @@
{
"_args": [
[
"xml2js@0.2.8",
"c:\\users\\luis\\source\\repos\\AACharly\\node_modules\\azure-storage"
"xml2js@0.2.7",
"C:\\Users\\Luis\\source\\repos\\AACloud"
]
],
"_from": "xml2js@0.2.8",
"_id": "xml2js@0.2.8",
"_inCache": true,
"_from": "xml2js@0.2.7",
"_id": "xml2js@0.2.7",
"_inBundle": false,
"_integrity": "sha1-GDhRi7AXQcrgh4urSRXklMMjBq8=",
"_location": "/xml2js",
"_npmUser": {
"email": "marek@xivilization.net",
"name": "leonidas"
},
"_npmVersion": "1.2.25",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "xml2js@0.2.7",
"name": "xml2js",
"raw": "xml2js@0.2.8",
"rawSpec": "0.2.8",
"scope": null,
"spec": "0.2.8",
"type": "version"
"escapedName": "xml2js",
"rawSpec": "0.2.7",
"saveSpec": null,
"fetchSpec": "0.2.7"
},
"_requiredBy": [
"/azure-storage"
],
"_resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.2.8.tgz",
"_shasum": "9b81690931631ff09d1957549faf54f4f980b3c2",
"_shrinkwrap": null,
"_spec": "xml2js@0.2.8",
"_where": "c:\\users\\luis\\source\\repos\\AACharly\\node_modules\\azure-storage",
"_resolved": "https://registry.npmjs.org/xml2js/-/xml2js-0.2.7.tgz",
"_spec": "0.2.7",
"_where": "C:\\Users\\Luis\\source\\repos\\AACloud",
"author": {
"email": "marek@xivilization.net",
"name": "Marek Kubica",
"email": "marek@xivilization.net",
"url": "http://xivilization.net"
},
"bugs": {
"url": "https://github.com/Leonidas-from-XIV/node-xml2js/issues"
},
"contributors": [
{
"name": "Michael Hart",
"url": "https://github.com/mhart"
},
{
"name": "maqr",
"email": "maqr.lollerskates@gmail.com",
"url": "https://github.com/maqr"
},
{
"name": "Ben Weaver",
"url": "http://benweaver.com/"
},
{
"name": "Jae Kwon",
"url": "https://github.com/jaekwon"
@@ -81,8 +77,8 @@
"url": "https://github.com/mdiniz"
},
{
"name": "Ben Weaver",
"url": "http://benweaver.com/"
"name": "Michael Hart",
"url": "https://github.com/mhart"
},
{
"name": "Zachary Scott",
@@ -116,50 +112,33 @@
"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.x"
"sax": "0.5.2"
},
"description": "Simple XML to JavaScript object converter.",
"devDependencies": {
"coffee-script": ">=1.6.3",
"coffee-script": ">=1.6.1",
"docco": ">=0.6.2",
"zap": ">=0.2.5"
},
"directories": {
"lib": "./lib"
},
"dist": {
"shasum": "9b81690931631ff09d1957549faf54f4f980b3c2",
"tarball": "https://registry.npmjs.org/xml2js/-/xml2js-0.2.8.tgz"
},
"homepage": "https://github.com/Leonidas-from-XIV/node-xml2js",
"installable": true,
"keywords": [
"json",
"xml"
"xml",
"json"
],
"main": "./lib/xml2js",
"maintainers": [
{
"name": "leonidas",
"email": "marek@xivilization.net"
}
],
"name": "xml2js",
"optionalDependencies": {},
"repository": {
"type": "git",
"url": "https://github.com/Leonidas-from-XIV/node-xml2js.git"
"url": "git+https://github.com/Leonidas-from-XIV/node-xml2js.git"
},
"scripts": {
"test": "zap"
},
"version": "0.2.8"
"version": "0.2.7"
}