Browse Source

fixed issue when 'unit' is not given to 'getUnitType'

pull/3/head
Brett Langdon 13 years ago
parent
commit
a12adcb8bb
1 changed files with 7 additions and 3 deletions
  1. +7
    -3
      lib/index.js

+ 7
- 3
lib/index.js View File

@ -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;


Loading…
Cancel
Save