Skip to main content

parseSubjectKey

@webda/core


Function: parseSubjectKey()

parseSubjectKey(pkFields, key): string | Record<string, string>

Defined in: packages/core/src/core/operations.ts:113

Turn a subject key sent by a client into a key usable with Model.ref().

Accepts the scalar value, an object of key fields, or for composite keys the canonical JSON array produced by serializeSubjectKey.

Parameters​

pkFields​

readonly string[]

the model primary key fields

key​

unknown

the key as received

Returns​

string | Record<string, string>

the key, or undefined when it does not match pkFields