feature(beautify) "Supported file types" -> "File type not supported"

This commit is contained in:
coderaiser 2014-10-24 05:33:40 -04:00
parent ad33e2410e
commit 50cbedd9f7

View file

@ -13,6 +13,9 @@
HOME_UNIX = process.env.HOME,
HOME = (HOME_UNIX || HOME_WIN) + '/',
EXT = ['js', 'css', 'html'],
ERROR_MSG = 'File type "{{ ext }}" not supported.',
ERROR_MSG_INST = 'Beautify not installed',
ConfigPath = DIR + 'json/beautify.json',
ConfigHome = HOME + '.beautify.json',
@ -21,17 +24,18 @@
tryRequire(ConfigPath, {log: true}) || {};
module.exports = function(name, callback) {
var EXT = ['js', 'css', 'html'],
ext = path
var ext = path
.extname(name)
.slice(1),
is = ~EXT.indexOf(ext);
if (!beautify)
callback(Error('Beautify not installed'));
callback(Error(ERROR_MSG_INST));
else if (!is)
callback(Error('Supported file types: ' + EXT.join(', ')));
callback(Error(Util.render(ERROR_MSG, {
ext : ext
})));
else
fs.readFile(name, 'utf8', function(error, data) {
var result;