Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
protected async loadFormatSpecsForQuantityTypes(useImperial: boolean): Promise {
const typeArray: QuantityType[] = [QuantityType.Length, QuantityType.Angle, QuantityType.Area, QuantityType.Volume, QuantityType.LatLong, QuantityType.Coordinate, QuantityType.Stationing, QuantityType.LengthSurvey, QuantityType.LengthEngineering];
const activeMap = useImperial ? this._imperialFormatSpecsByType : this._metricFormatSpecsByType;
activeMap.clear();
for (const quantityType of typeArray) {
const formatPromise = this.getFormatByQuantityType(quantityType, useImperial);
const unitPromise = this.getUnitByQuantityType(quantityType);
const [format, unit] = await Promise.all([formatPromise, unitPromise]);
const spec = await FormatterSpec.create(format.name, format, this, unit);
activeMap.set(quantityType, spec);
}
return Promise.resolve();
}