diff options
author | Florian Dold <florian.dold@gmail.com> | 2016-11-03 01:33:53 +0100 |
---|---|---|
committer | Florian Dold <florian.dold@gmail.com> | 2016-11-03 01:33:53 +0100 |
commit | d1291f67551c58168af43698a359cb5ddfd266b0 (patch) | |
tree | 55a13ed29fe1915e3f42f1b1b7038dafa2e975a7 /node_modules/xmlbuilder/lib/XMLWriterBase.js | |
parent | d0a0695fb5d34996850723f7d4b1b59c3df909c2 (diff) |
node_modules
Diffstat (limited to 'node_modules/xmlbuilder/lib/XMLWriterBase.js')
-rw-r--r-- | node_modules/xmlbuilder/lib/XMLWriterBase.js | 68 |
1 files changed, 68 insertions, 0 deletions
diff --git a/node_modules/xmlbuilder/lib/XMLWriterBase.js b/node_modules/xmlbuilder/lib/XMLWriterBase.js new file mode 100644 index 000000000..0b28662e4 --- /dev/null +++ b/node_modules/xmlbuilder/lib/XMLWriterBase.js @@ -0,0 +1,68 @@ +// Generated by CoffeeScript 1.10.0 +(function() { + var XMLWriterBase, + hasProp = {}.hasOwnProperty; + + module.exports = XMLWriterBase = (function() { + function XMLWriterBase(options) { + var key, ref, ref1, ref2, ref3, ref4, value; + options || (options = {}); + this.pretty = options.pretty || false; + this.allowEmpty = (ref = options.allowEmpty) != null ? ref : false; + if (this.pretty) { + this.indent = (ref1 = options.indent) != null ? ref1 : ' '; + this.newline = (ref2 = options.newline) != null ? ref2 : '\n'; + this.offset = (ref3 = options.offset) != null ? ref3 : 0; + } else { + this.indent = ''; + this.newline = ''; + this.offset = 0; + } + ref4 = options.writer || {}; + for (key in ref4) { + if (!hasProp.call(ref4, key)) continue; + value = ref4[key]; + this[key] = value; + } + } + + XMLWriterBase.prototype.set = function(options) { + var key, ref, value; + options || (options = {}); + if ("pretty" in options) { + this.pretty = options.pretty; + } + if ("allowEmpty" in options) { + this.allowEmpty = options.allowEmpty; + } + if (this.pretty) { + this.indent = "indent" in options ? options.indent : ' '; + this.newline = "newline" in options ? options.newline : '\n'; + this.offset = "offset" in options ? options.offset : 0; + } else { + this.indent = ''; + this.newline = ''; + this.offset = 0; + } + ref = options.writer || {}; + for (key in ref) { + if (!hasProp.call(ref, key)) continue; + value = ref[key]; + this[key] = value; + } + return this; + }; + + XMLWriterBase.prototype.space = function(level) { + if (this.pretty) { + return new Array((level || 0) + this.offset + 1).join(this.indent); + } else { + return ''; + } + }; + + return XMLWriterBase; + + })(); + +}).call(this); |