1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2025-05-10 07:47:07 +01:00

Improve behavior of PEEK command.

This commit is contained in:
hacksalot
2016-01-18 18:35:38 -05:00
parent e72564162b
commit d220cedfeb
5 changed files with 33 additions and 20 deletions

View File

@ -45,15 +45,24 @@ Implementation of the 'peek' verb for HackMyResume.
var objPath = (dst && dst[0]) || '';
_.each( src, function( t ) {
this.stat( HMEVENT.beforePeek, { file: t, target: objPath } );
var obj = safeLoadJSON( t );
if( obj.ex ) {
this.err( obj.ex.fluenterror, obj.ex );
}
var targ = objPath ? __.get( obj.json, objPath ) : obj.json;
this.stat( HMEVENT.beforePeek, { file: t, target: objPath, isError: obj.ex } );
if( obj.ex ) {
if( obj.ex.operation === 'parse' )
this.err( HMSTATUS.parseError, obj.ex );
else {
obj.ex.quiet = true;
this.err( HMSTATUS.readError, obj.ex );
}
return;
}
var targ = objPath ? __.get( obj.json, objPath ) : obj.json;
this.stat( HMEVENT.afterPeek, { file: t, requested: objPath, target: targ } );
}, this);
}