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

41 lines
1019 B
JavaScript
Raw Normal View History

2016-01-27 10:29:26 +00:00
(function() {
2018-02-12 05:05:29 +00:00
/**
Definition of the JsonYamlGenerator class.
@module generators/json-yaml-generator
@license MIT. See LICENSE.md for details.
*/
var BaseGenerator, FS, JsonYamlGenerator, YAML;
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).
2018-02-12 05:05:29 +00:00
*/
module.exports = JsonYamlGenerator = class JsonYamlGenerator extends BaseGenerator {
constructor() {
super('yml');
}
2018-02-12 05:05:29 +00:00
invoke(rez, themeMarkup, cssInfo, opts) {
return YAML.stringify(JSON.parse(rez.stringify()), 2e308, 2);
}
2018-02-12 05:05:29 +00:00
generate(rez, f, opts) {
2016-01-27 10:29:26 +00:00
var data;
2018-02-12 05:05:29 +00:00
data = YAML.stringify(JSON.parse(rez.stringify()), 2e308, 2);
2016-02-02 02:14:36 +00:00
FS.writeFileSync(f, data, 'utf8');
return data;
2018-02-12 05:05:29 +00:00
}
2018-02-12 05:05:29 +00:00
};
2016-01-27 10:29:26 +00:00
}).call(this);
2016-02-02 02:14:36 +00:00
//# sourceMappingURL=json-yaml-generator.js.map