From bd8b587c5b6648dfba0c537959f00661eba9fff2 Mon Sep 17 00:00:00 2001 From: hacksalot Date: Sat, 9 Jan 2016 22:34:21 -0500 Subject: [PATCH] Remove explicit logger and error handler params. --- src/verbs/analyze.js | 9 ++++----- src/verbs/build.js | 25 +++---------------------- src/verbs/convert.js | 5 ++--- src/verbs/create.js | 2 +- src/verbs/validate.js | 5 ++--- 5 files changed, 12 insertions(+), 34 deletions(-) diff --git a/src/verbs/analyze.js b/src/verbs/analyze.js index cbb3ff8..4454034 100644 --- a/src/verbs/analyze.js +++ b/src/verbs/analyze.js @@ -37,16 +37,15 @@ Implementation of the 'analyze' verb for HackMyResume. /** Run the 'analyze' command. */ - function analyze( sources, dst, opts, logger ) { + function analyze( sources, dst, opts ) { this.stat('begin'); - var _log = logger || console.log; if( !sources || !sources.length ) throw { fluenterror: 3 }; var nlzrs = _loadInspectors(); _.each(sources, function(src) { var result = ResumeFactory.loadOne( src, { - log: _log, format: 'FRESH', objectify: true, throw: false + format: 'FRESH', objectify: true, throw: false }); - result.error || _analyze.call(this, result, nlzrs, opts, _log ); + result.error || _analyze.call(this, result, nlzrs, opts ); }, this); this.stat('end'); } @@ -56,7 +55,7 @@ Implementation of the 'analyze' verb for HackMyResume. /** Analyze a single resume. */ - function _analyze( resumeObject, nlzrs, opts, log ) { + function _analyze( resumeObject, nlzrs, opts ) { var rez = resumeObject.rez; var safeFormat = (rez.meta && rez.meta.format && rez.meta.format.startsWith('FRESH')) ? diff --git a/src/verbs/build.js b/src/verbs/build.js index c220316..3eeaa81 100644 --- a/src/verbs/build.js +++ b/src/verbs/build.js @@ -51,11 +51,11 @@ Implementation of the 'generate' verb for HackMyResume. @param theme Friendly name of the resume theme. Defaults to "modern". @param logger Optional logging override. */ - function build( src, dst, opts, logger, errHandler ) { + function build( src, dst, opts ) { this.stat( HME.begin ); - prep( src, dst, opts, logger, errHandler ); + prep( src, dst, opts ); // Load the theme...we do this first because the theme choice (FRESH or // JSON Resume) determines what format we'll convert the resume to. @@ -102,11 +102,7 @@ Implementation of the 'generate' verb for HackMyResume. /** Prepare for a BUILD run. */ - function prep( src, dst, opts, logger, errHandler ) { - - // Housekeeping - _log = logger || console.log; - _err = errHandler || error; + function prep( src, dst, opts ) { // Cherry-pick options //_opts = extend( true, _opts, opts ); _opts.theme = (opts.theme && opts.theme.toLowerCase().trim()) || 'modern'; @@ -300,19 +296,4 @@ Implementation of the 'generate' verb for HackMyResume. - /** - Handle an exception. Placeholder. - */ - function error( ex ) { - throw ex; - } - - - - function MDIN(txt) { // TODO: Move this - return MD(txt || '' ).replace(/^\s*

|<\/p>\s*$/gi, ''); - } - - - }()); diff --git a/src/verbs/convert.js b/src/verbs/convert.js index 75ecd98..9d75f73 100644 --- a/src/verbs/convert.js +++ b/src/verbs/convert.js @@ -35,10 +35,9 @@ Implementation of the 'convert' verb for HackMyResume. /** Convert between FRESH and JRS formats. */ - function convert( srcs, dst, opts, logger ) { + function convert( srcs, dst, opts ) { // Housekeeping - var _log = logger || console.log; if( !srcs || !srcs.length ) { throw { fluenterror: 6 }; } if( !dst || !dst.length ) { if( srcs.length === 1 ) { @@ -60,7 +59,7 @@ Implementation of the 'convert' verb for HackMyResume. // Load the resume var rinfo = ResumeFactory.loadOne( src, { - log: _log, format: null, objectify: true, throw: true + format: null, objectify: true, throw: true }); var s = rinfo.rez diff --git a/src/verbs/create.js b/src/verbs/create.js index e26dfbb..de10419 100644 --- a/src/verbs/create.js +++ b/src/verbs/create.js @@ -37,7 +37,7 @@ Implementation of the 'create' verb for HackMyResume. /** Create a new empty resume in either FRESH or JRS format. */ - function create( src, dst, opts/*, logger*/ ) { + function create( src, dst, opts ) { if(!src || !src.length) throw {fluenterror: HACKMYSTATUS.createNameMissing}; this.stat( HME.begin ); diff --git a/src/verbs/validate.js b/src/verbs/validate.js index 64a3de5..51ad436 100644 --- a/src/verbs/validate.js +++ b/src/verbs/validate.js @@ -32,8 +32,8 @@ Implementation of the 'validate' verb for HackMyResume. /** Validate 1 to N resumes in either FRESH or JSON Resume format. */ - function validate( sources, unused, opts, logger ) { - var _log = logger || console.log; + function validate( sources, unused, opts ) { + if( !sources || !sources.length ) { throw { fluenterror: 6 }; } var isValid = true; @@ -44,7 +44,6 @@ Implementation of the 'validate' verb for HackMyResume. }; var resumes = ResumeFactory.load( sources, { - log: _log, format: null, objectify: false, throw: false,