---
url: /docs/api/core/functions/resolveAffineUnit.md
---
[**@kaiord/core**](../README.md)

***

[@kaiord/core](../README.md) / resolveAffineUnit

# Function: resolveAffineUnit()

> **resolveAffineUnit**(`param`, `unitRaw`): [`AffineUnit`](../type-aliases/AffineUnit.md) | `null`

Defined in: [packages/core/src/domain/lab/unit-conversion.ts:28](https://github.com/pablo-albaladejo/kaiord/blob/3eacbe62ef72342d970523967cc5155b5935bb85/packages/core/src/domain/lab/unit-conversion.ts#L28)

Resolve the affine transform for `unitRaw` on a parameter. The canonical
unit maps to identity (factor 1). A free parameter (`param` undefined) or an
unrecognized unit returns `null`, signalling passthrough (no conversion).

## Parameters

### param

{ `canonicalRefHigh?`: `number`; `canonicalRefLow?`: `number`; `canonicalUnit`: `string`; `key`: `string`; `knownUnits?`: `object`\[]; `loinc?`: `string`; `panel`: `"hemogram"` | `"biochemistry"` | `"lipids"` | `"hepatic"` | `"ions"` | `"iron"` | `"thyroid"` | `"vitamins"` | `"hormones"` | `"sports"`; `refBySex?`: { `female`: { `high?`: `number`; `low?`: `number`; }; `male`: { `high?`: `number`; `low?`: `number`; }; }; } | `undefined`

### unitRaw

`string`

## Returns

[`AffineUnit`](../type-aliases/AffineUnit.md) | `null`
