Skip to content

serializeSort

function serializeSort(input): string;

Defined in: filters/sort.ts:71

Serialize the model back to the compact query form (field:dir, comma separated) — the inverse of parseSortParam.

Parameter Type
input { sort: Sort; }
input.sort Sort

string

import { serializeSort } from "@xtandard/lib/filters";
serializeSort({
sort: [
{ field: "createdAt", dir: "desc" },
{ field: "name", dir: "asc" },
],
}); // → "createdAt:desc,name:asc"
serializeSort({ sort: [] }); // → ""