1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-11-22 00:10:15 +00:00

Merge JSON properties onto sheet.

This commit is contained in:
devlinjd 2015-09-16 19:32:42 -04:00
parent efd6206462
commit ed3fc12806
2 changed files with 8 additions and 5 deletions

View File

@ -54,14 +54,14 @@ module.exports = function () {
// Merge input resumes // Merge input resumes
rez = sheets.reduce( function( acc, elem ) { rez = sheets.reduce( function( acc, elem ) {
return extend(true, acc.rep, elem.rep); return extend( true, acc.rep, elem.rep );
}); });
// Run the transformation! // Run the transformation!
var finished = targets.map( gen ); var finished = targets.map( gen );
return { return {
sheet: rez.rep, sheet: rez,//.rep,
targets: targets, targets: targets,
processed: finished processed: finished
}; };
@ -80,7 +80,7 @@ module.exports = function () {
var fName = path.basename( f, '.' + fType ); var fName = path.basename( f, '.' + fType );
// Get the format object (if any) corresponding to that type, and assemble // Get the format object (if any) corresponding to that type, and assemble
// thefinal output file path for the generated resume. // the final output file path for the generated resume.
var fObj = _fmts.filter( function(_f) { return _f.name === fType; } )[0]; var fObj = _fmts.filter( function(_f) { return _f.name === fType; } )[0];
var fOut = path.join( f.substring( 0, f.lastIndexOf('.') + 1 ) + fObj.ext ); var fOut = path.join( f.substring( 0, f.lastIndexOf('.') + 1 ) + fObj.ext );
console.log( 'Generating ' + fType.toUpperCase() + ' resume: ' + fOut ); console.log( 'Generating ' + fType.toUpperCase() + ' resume: ' + fOut );

View File

@ -6,6 +6,7 @@ Abstract character/resume sheet representation.
(function() { (function() {
var FS = require('fs'); var FS = require('fs');
var extend = require('./extend');
function Sheet() { function Sheet() {
this.id = null; this.id = null;
@ -15,9 +16,11 @@ Abstract character/resume sheet representation.
} }
Sheet.prototype.open = function( file, title ) { Sheet.prototype.open = function( file, title ) {
this.rep = JSON.parse( FS.readFileSync( file, 'utf8' ) ); var rep = JSON.parse( FS.readFileSync( file, 'utf8' ) );
extend( true, this, rep );
console.log( this );
this.fileName = file; this.fileName = file;
this.title = title || this.rep.basics.name; this.title = title || this.basics.name;
return this; return this;
}; };