createUnitsProvider Function
Returns a UnitsProvider that layers the basic BIS units under (or over) an optional
primary provider. Typical use: layer an iModel's schema units on top of the bundled
defaults from @itwin/core-quantity.
Precedence rules:
- When
primaryis supplied andbisUnitsPolicyis"preferSchema"(the default):primarywins; basic BIS units fill any gaps whereprimaryreturns an invalid unit or throws. - When
bisUnitsPolicyis"preferBundled": basic BIS units win;primaryis consulted only when the basic provider can't answer. getUnitsByFamilyalways merges results from both providers, deduplicated byUnitProps.name(fully-qualified). The first-consulted provider wins ties.- When no
primaryis supplied, the returned provider is exactlynew BasicUnitsProvider()(no wrapper), preservinginstanceofchecks and keeping the hot path fast.
createUnitsProvider(options: CreateUnitsProviderOptions = {}): UnitsProvider
| Parameter | Type | Description |
|---|---|---|
| options | CreateUnitsProviderOptions |
Returns - UnitsProvider
Defined in
Last Updated: 01 May, 2026
Found something wrong, missing, or unclear on this page? Raise an issue in our repo.