convert-units icon indicating copy to clipboard operation
convert-units copied to clipboard

Unable to use toBest correctly

Open nicholasgcoles opened this issue 6 years ago • 0 comments

Hello

Thanks for the great library!

I am trying to convert from Metric to imperial (ha to ac)

For some reason when I get all the metric options to exclude

const excluded = return convert().list('area').filter((unit) => {
  return unit.system === 'metric';
}).map(item => (item.abbr));

And then try find the toBest() value

convert(100).from('ha').toBest({ exclude: ['m2', 'km2', 'ha', 'cm2', 'mm2'] })

It keeps returning undefined but then as soon as I take one of the excluded options out (such as mm2) it returns a toBest of mm2 and never does it include any of the imperial units?

Sorry if I am making a silly mistake

nicholasgcoles avatar Aug 01 '18 17:08 nicholasgcoles