You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
20 lines
376 B
20 lines
376 B
4 weeks ago
|
'use strict';
|
||
|
|
||
|
var typeMap = {};
|
||
|
var types = require('./types');
|
||
|
|
||
|
// load all available handlers
|
||
|
types.forEach(function (type) {
|
||
|
typeMap[type] = require('./types/' + type).detect;
|
||
|
});
|
||
|
|
||
|
module.exports = function (buffer, filepath) {
|
||
|
var type, result;
|
||
|
for (type in typeMap) {
|
||
|
result = typeMap[type](buffer, filepath);
|
||
|
if (result) {
|
||
|
return type;
|
||
|
}
|
||
|
}
|
||
|
};
|