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 loadParsingSpecsForQuantityTypes(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._imperialParserSpecsByType : this._metricUnitParserSpecsByType;
activeMap.clear();
for (const quantityType of typeArray) {
const formatPromise = this.getFormatByQuantityType(quantityType, useImperial);
const unitPromise = this.getUnitByQuantityType(quantityType);
const [format, outUnit] = await Promise.all([formatPromise, unitPromise]);
const parserSpec = await ParserSpec.create(format, this, outUnit);
activeMap.set(quantityType, parserSpec);
}
return Promise.resolve();
}