---
url: "https://vueda.dev/v3/reference/api/js/utils/sortedFields/functions/formatSortField.md"
title: "formatSortField"
---

# formatSortField

## Overview

Build a sort entry from a base field name and direction.

## Signature

`formatSortField(base, descending)`

### Parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| <span id="param-base">base</span> | `string` | yes | The field name. |
| <span id="param-descending">descending</span> | `boolean` | no | When true, prefix with `-`. |

### Returns

`string`

## Source

`client/lib/utils/sortedFields.js:39`
