Units: support farenheit (existing misspelling) (#21249)

This commit is contained in:
Ryan McKinley
2019-12-23 22:05:26 -08:00
committed by GitHub
parent e031cbb1a1
commit af2cd77655
2 changed files with 16 additions and 0 deletions

View File

@@ -123,4 +123,12 @@ describe('valueFormats', () => {
expect(str).toBe('186');
});
});
describe('Resolve old units', () => {
it('resolve farenheit', () => {
const fmt0 = getValueFormat('farenheit');
const fmt1 = getValueFormat('fahrenheit');
expect(fmt0).toEqual(fmt1);
});
});
});

View File

@@ -164,6 +164,14 @@ function buildFormats() {
}
}
// Resolve units pointing to old IDs
[{ from: 'farenheit', to: 'fahrenheit' }].forEach(alias => {
const f = index[alias.to];
if (f) {
index[alias.from] = f;
}
});
hasBuiltIndex = true;
}