Sha256: 866312ea1fe7b564b8d1ce6239e93c3766f9aae100c9281745a53e7a7979b51a
Contents?: true
Size: 560 Bytes
Versions: 69
Compression:
Stored size: 560 Bytes
Contents
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 || { }; if (opts.json !== false && fullPath.match(/\.json$/i)) { opts.json = true; } fs.readFile(fullPath, 'utf-8', function (err, code) { if (err) return cb(err); try { cb(null, highlight(code, opts)); } catch (e) { cb(e); } }); };
Version data entries
69 entries across 69 versions & 2 rubygems