scratch

Subversion Repositories:
Compare Path: Rev
With Path: Rev
?path1? @ 74  →  ?path2? @ 75
/bower_components/yaml.js/lib/Dumper.js
@@ -0,0 +1,53 @@
// Generated by CoffeeScript 1.10.0
var Dumper, Inline, Utils;
 
Utils = require('./Utils');
 
Inline = require('./Inline');
 
Dumper = (function() {
function Dumper() {}
 
Dumper.indentation = 4;
 
Dumper.prototype.dump = function(input, inline, indent, exceptionOnInvalidType, objectEncoder) {
var i, key, len, output, prefix, value, willBeInlined;
if (inline == null) {
inline = 0;
}
if (indent == null) {
indent = 0;
}
if (exceptionOnInvalidType == null) {
exceptionOnInvalidType = false;
}
if (objectEncoder == null) {
objectEncoder = null;
}
output = '';
prefix = (indent ? Utils.strRepeat(' ', indent) : '');
if (inline <= 0 || typeof input !== 'object' || input instanceof Date || Utils.isEmpty(input)) {
output += prefix + Inline.dump(input, exceptionOnInvalidType, objectEncoder);
} else {
if (input instanceof Array) {
for (i = 0, len = input.length; i < len; i++) {
value = input[i];
willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value);
output += prefix + '-' + (willBeInlined ? ' ' : "\n") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? "\n" : '');
}
} else {
for (key in input) {
value = input[key];
willBeInlined = inline - 1 <= 0 || typeof value !== 'object' || Utils.isEmpty(value);
output += prefix + Inline.dump(key, exceptionOnInvalidType, objectEncoder) + ':' + (willBeInlined ? ' ' : "\n") + this.dump(value, inline - 1, (willBeInlined ? 0 : indent + this.indentation), exceptionOnInvalidType, objectEncoder) + (willBeInlined ? "\n" : '');
}
}
}
return output;
};
 
return Dumper;
 
})();
 
module.exports = Dumper;