Skip to content

Commit

Permalink
More strict about units [finish #151451434]
Browse files Browse the repository at this point in the history
  • Loading branch information
cannawen committed Sep 26, 2017
1 parent d7e18a6 commit a8b2624
Showing 1 changed file with 6 additions and 6 deletions.
12 changes: 6 additions & 6 deletions src/conversion_helper.js
Original file line number Diff line number Diff line change
Expand Up @@ -39,10 +39,10 @@ function volumeMap(l) {
}
}

const metricDistanceUnits = [/\bmm\b/, /\bcm\b/, /\bm\b/, /\bkm\b/, /light-?years?/,
const metricDistanceUnits = [/\bkm\b/, /light-?years?/,
/(?:milli|centi|deca|kilo)?met(?:re|er)s?/];
const metricWeightUnits = [/\bg\b/, /kgs?/, /grams?/, /kilograms?/];
const metricVolumeUnits = [/\bl\b/, /(?:milli|centi|deca|kilo)?lit(?:er|re)s?/];
const metricWeightUnits = [/kgs?/, /grams?/, /kilograms?/];
const metricVolumeUnits = [/(?:milli|centi|deca|kilo)?lit(?:er|re)s?/];

const unitLookupList = [
{
Expand Down Expand Up @@ -87,7 +87,7 @@ const unitLookupList = [
return [createMap(km, " km/h"), perSMap];
}
},
"ignoredUnits" : ["km/hr?", "kph", "kilometers? ?(?:per|an|/) ?hour", "m/s"],
"ignoredUnits" : ["km/hr?", "kmh", "kph", "kilometers? ?(?:per|an|/) ?hour", "m/s"],
"ignoredKeywords" : ["britain", "british", "england", "scotland", "wales", "uk"]
},
{
Expand Down Expand Up @@ -259,7 +259,7 @@ const unitLookupList = [
"ignoredUnits" : ["imperial"].concat(metricVolumeUnits)
},
{
"imperialUnits" : [/(?:°|-?degrees?) ?(?:f|fahrenheit)/, /-?fahrenheit/],
"imperialUnits" : [/(?:° ?|-?degrees?) ?(?:f|fahrenheit)/, /-?fahrenheit/],
"weakImperialUnits" : ["f", "-?degrees?"],
"standardInputUnit" : "°F",
"isInvalidInput" : (i) => false,
Expand All @@ -272,7 +272,7 @@ const unitLookupList = [
return temperatureMap;
}
},
"ignoredUnits" : [/°C/, "degrees? c", "celsius", "kelvin"]
"ignoredUnits" : [/° ?C/, "degrees? c", "celsius", "kelvin"]
}
];

Expand Down

0 comments on commit a8b2624

Please sign in to comment.