diff --git a/lib/index.js b/lib/index.js index a0e795f..072f611 100644 --- a/lib/index.js +++ b/lib/index.js @@ -173,6 +173,10 @@ var convert = function(type, value, from, to, max_calls){ var get_variations = function(unit){ + if(unit == null || unit == undefined){ + return []; + } + var variations = [unit]; if(unit.length == 2){ return variations; @@ -231,12 +235,12 @@ return module.exports = { return unit_database; }, getUnitType: function(unit){ - var type = determine_type(get_variations(unit)); - if(!type){ + var types = determine_type(get_variations(unit)); + if(!types){ return null; } - return type; + return types; }, convert: function(str){ var value, from, to;