Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Some CoffeeScript compiler iffyness

  • Loading branch information...
commit ce47a551ee8510da3256b25950358eea655311cf 1 parent 2d393ec
@Leonidas-from-XIV authored
Showing with 17 additions and 10 deletions.
  1. +12 −8 lib/xml2js.js
  2. +5 −2 src/xml2js.coffee
View
20 lib/xml2js.js
@@ -1,9 +1,9 @@
-// Generated by CoffeeScript 1.5.0
+// 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');
@@ -69,9 +69,14 @@
__extends(Parser, _super);
function Parser(opts) {
- this.parseString = __bind(this.parseString, this);
- this.reset = __bind(this.reset, this);
- var key, value, _ref;
+ 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) {
@@ -157,9 +162,8 @@
obj = obj[charkey];
}
}
-
- if (isEmpty(obj) && stack.length > 0){
- obj = (_this.options.emptyTag !== void 0) ? _this.options.emptyTag : '';
+ if ((isEmpty(obj)) && stack.length > 0) {
+ obj = _this.options.emptyTag !== void 0 ? _this.options.emptyTag : '';
}
if (_this.options.validator != null) {
xpath = "/" + ((function() {
View
7 src/xml2js.coffee
@@ -135,8 +135,11 @@ class exports.Parser extends events.EventEmitter
if Object.keys(obj).length == 1 and charkey of obj and not @EXPLICIT_CHARKEY
obj = obj[charkey]
- if isEmpty obj && stack.length > 0
- obj = @options.emptyTag != undefined ? @options.emptyTag : '';
+ if (isEmpty obj) and stack.length > 0
+ obj = if @options.emptyTag != undefined
+ @options.emptyTag
+ else
+ ''
if @options.validator?
xpath = "/" + (node["#name"] for node in stack).concat(nodeName).join("/")
Please sign in to comment.
Something went wrong with that request. Please try again.