Skip to main content

@rtorcato/db-common / orderBy

Function: orderBy()

orderBy(input): Sort[]

Defined in: order-by.ts:16

Normalize sort input into a list of { col, dir }. Accepts a comma-separated string or an array of tokens; a leading - marks a column descending. Empty tokens are dropped.

orderBy('name,-createdAt') // → [{ col: 'name', dir: 'asc' }, { col: 'createdAt', dir: 'desc' }]

Parameters

input

string | string[]

Returns

Sort[]