> For AI agents: the complete documentation index is available at https://massaman.dev/llms.txt, the full documentation bundle is available at https://massaman.dev/llms-full.txt.

# descend

Creates a descending comparator from an accessor function.

```typescript
users.sort(descend(u => u.age))
```

## Usage

### `descend<T>(fn: (value: T) => number | string)`

Creates a descending comparator from an accessor function.

```typescript
import { descend } from 'massaman'
// or:  import { descend } from 'massaman/array'

users.sort(descend(u => u.age))
```

#### Parameters


fn(value: T) => number | stringrequired

the function to apply.

#### Returns

a descending comparator suitable for `Array.prototype.sort` or `toSorted`.

```typescript
(a: T, b: T) => number
```
