2016-01-27 10:29:26 +00:00
|
|
|
(function() {
|
2018-02-12 05:05:29 +00:00
|
|
|
/**
|
|
|
|
Definition of the JsonGenerator class.
|
|
|
|
@module generators/json-generator
|
|
|
|
@license MIT. See LICENSE.md for details.
|
|
|
|
*/
|
|
|
|
var BaseGenerator, FJCV, FS, JsonGenerator, _;
|
2016-01-27 10:29:26 +00:00
|
|
|
|
|
|
|
BaseGenerator = require('./base-generator');
|
|
|
|
|
|
|
|
FS = require('fs');
|
|
|
|
|
|
|
|
_ = require('underscore');
|
|
|
|
|
2016-02-13 21:08:45 +00:00
|
|
|
FJCV = require('fresh-jrs-converter');
|
2016-01-27 10:29:26 +00:00
|
|
|
|
2016-02-13 21:08:45 +00:00
|
|
|
/** The JsonGenerator generates a FRESH or JRS resume as an output. */
|
2018-02-12 05:05:29 +00:00
|
|
|
module.exports = JsonGenerator = class JsonGenerator extends BaseGenerator {
|
|
|
|
constructor() {
|
|
|
|
super('json');
|
2016-02-02 18:38:12 +00:00
|
|
|
}
|
|
|
|
|
2018-02-12 05:05:29 +00:00
|
|
|
invoke(rez) {
|
2016-02-13 21:08:45 +00:00
|
|
|
var altRez;
|
|
|
|
altRez = FJCV['to' + (rez.format() === 'FRESH' ? 'JRS' : 'FRESH')](rez);
|
|
|
|
return altRez = FJCV.toSTRING(altRez);
|
2018-02-12 05:05:29 +00:00
|
|
|
}
|
2016-02-02 18:38:12 +00:00
|
|
|
|
2018-02-12 05:05:29 +00:00
|
|
|
//altRez.stringify()
|
|
|
|
generate(rez, f) {
|
2016-01-27 10:29:26 +00:00
|
|
|
FS.writeFileSync(f, this.invoke(rez), 'utf8');
|
2018-02-12 05:05:29 +00:00
|
|
|
}
|
2016-02-02 18:38:12 +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-generator.js.map
|