Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
continue;
}
if (entry.displayLabel === unitLabel || entry.name === unitLabel) {
const unitProps = new BasicUnit(entry.name, entry.displayLabel, entry.unitFamily, entry.altDisplayLabels);
return Promise.resolve(unitProps);
}
if (entry.altDisplayLabels && entry.altDisplayLabels.length > 0) {
if (entry.altDisplayLabels.findIndex((ref) => ref === unitLabel) !== -1) {
const unitProps = new BasicUnit(entry.name, entry.displayLabel, entry.unitFamily, entry.altDisplayLabels);
return Promise.resolve(unitProps);
}
}
}
return Promise.resolve(new BadUnit());
}
public async findUnitByName(unitName: string): Promise {
const unitDataEntry = this.findUnitDefinition(unitName);
if (unitDataEntry) {
return Promise.resolve(new BasicUnit(unitDataEntry.name, unitDataEntry.displayLabel, unitDataEntry.unitFamily, unitDataEntry.altDisplayLabels));
}
return Promise.resolve(new BadUnit());
}