1
0
mirror of https://github.com/JuanCanham/HackMyResume.git synced 2024-10-06 15:35:11 +01:00
HackMyResume/src/utils/safe-json-loader.js

25 lines
363 B
JavaScript
Raw Normal View History

2016-01-04 07:50:00 +00:00
/**
Definition of the SafeJsonLoader class.
@module syntax-error-ex.js
@license MIT. See LICENSE.md for details.
*/
(function() {
var FS = require('fs');
module.exports = function loadSafeJson( file ) {
try {
return JSON.parse( FS.readFileSync( file ) );
}
catch(ex) {
loadSafeJson.error = ex;
}
return null;
};
}());