1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-16 22:00:09 +00:00
HackMyResume/dist/generators/json-yaml-generator.js

51 lines
1.5 KiB
JavaScript
Raw Normal View History

2016-01-27 10:29:26 +00:00
/**
Definition of the JsonYamlGenerator class.
@module generators/json-yaml-generator
2016-01-27 10:29:26 +00:00
@license MIT. See LICENSE.md for details.
*/
(function() {
var BaseGenerator, FS, JsonYamlGenerator, YAML,
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;
2016-01-27 10:29:26 +00:00
BaseGenerator = require('./base-generator');
FS = require('fs');
YAML = require('yamljs');
/**
JsonYamlGenerator takes a JSON resume object and translates it directly to
JSON without a template, producing an equivalent YAML-formatted resume. See
also YamlGenerator (yaml-generator.js).
*/
module.exports = JsonYamlGenerator = (function(superClass) {
extend(JsonYamlGenerator, superClass);
function JsonYamlGenerator() {
JsonYamlGenerator.__super__.constructor.call(this, 'yml');
}
JsonYamlGenerator.prototype.invoke = function(rez, themeMarkup, cssInfo, opts) {
2016-01-27 10:29:26 +00:00
return YAML.stringify(JSON.parse(rez.stringify()), Infinity, 2);
};
JsonYamlGenerator.prototype.generate = function(rez, f, opts) {
2016-01-27 10:29:26 +00:00
var data;
data = YAML.stringify(JSON.parse(rez.stringify()), Infinity, 2);
2016-02-02 02:14:36 +00:00
FS.writeFileSync(f, data, 'utf8');
return data;
};
return JsonYamlGenerator;
})(BaseGenerator);
2016-01-27 10:29:26 +00:00
}).call(this);
2016-02-02 02:14:36 +00:00
//# sourceMappingURL=json-yaml-generator.js.map