wallet-core/node_modules/xmlbuilder/lib/XMLComment.js

50 lines
1.7 KiB
JavaScript
Raw Normal View History

// Generated by CoffeeScript 1.9.1
2016-11-03 01:33:53 +01:00
(function() {
var XMLComment, XMLNode, create,
2016-11-03 01:33:53 +01:00
extend = 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; },
hasProp = {}.hasOwnProperty;
create = require('lodash/create');
2016-11-03 01:33:53 +01:00
XMLNode = require('./XMLNode');
module.exports = XMLComment = (function(superClass) {
extend(XMLComment, superClass);
function XMLComment(parent, text) {
XMLComment.__super__.constructor.call(this, parent);
if (text == null) {
throw new Error("Missing comment text");
}
this.text = this.stringify.comment(text);
}
XMLComment.prototype.clone = function() {
return create(XMLComment.prototype, this);
2016-11-03 01:33:53 +01:00
};
XMLComment.prototype.toString = function(options, level) {
var indent, newline, offset, pretty, r, ref, ref1, ref2, space;
pretty = (options != null ? options.pretty : void 0) || false;
indent = (ref = options != null ? options.indent : void 0) != null ? ref : ' ';
offset = (ref1 = options != null ? options.offset : void 0) != null ? ref1 : 0;
newline = (ref2 = options != null ? options.newline : void 0) != null ? ref2 : '\n';
level || (level = 0);
space = new Array(level + offset + 1).join(indent);
r = '';
if (pretty) {
r += space;
}
r += '<!-- ' + this.text + ' -->';
if (pretty) {
r += newline;
}
return r;
2016-11-03 01:33:53 +01:00
};
return XMLComment;
})(XMLNode);
}).call(this);