This commit is contained in:
oitsjustjose 2017-02-26 17:06:42 -05:00
commit 6b60015c02
9588 changed files with 1149251 additions and 49 deletions

23
node_modules/cardinal/lib/highlightFile.js generated vendored Normal file
View file

@ -0,0 +1,23 @@
var fs = require('fs')
, highlight = require('./highlight');
function isFunction (obj) {
return toString.call(obj) == '[object Function]';
}
module.exports = function highlightFile (fullPath, opts, cb) {
if (isFunction(opts)) {
cb = opts;
opts = { };
}
opts = opts || { };
fs.readFile(fullPath, 'utf-8', function (err, code) {
if (err) return cb(err);
try {
cb(null, highlight(code, opts));
} catch (e) {
cb(e);
}
});
};