# @types/multisort

> TypeScript definitions for multisort

Latest version **0.5.2** (published 2023-11-07) · MIT license · 0 weekly downloads

## Install

```sh
npm install @types/multisort
pnpm add @types/multisort
yarn add @types/multisort
bun add @types/multisort
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; no vulnerabilities; high maintenance score; popular repo; extremely popular.

Warnings: low downloads; no esm support; pre 1.0.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 0.5.2 |
| Published | 2023-11-07 |
| First published | 2018-01-05 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.2 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 51443 |
| Maintainers | types |

## Links

- npm: https://www.npmjs.com/package/@types/multisort
- Repository: https://github.com/DefinitelyTyped/DefinitelyTyped
- Homepage: https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/multisort
- npm.io page: https://npm.io/package/@types/multisort

## Recent versions

- 0.5.2 (latest) — 2023-11-07
- 0.5.0 (ts2.0) — 2018-01-05
- 0.5.1 — 2023-10-18

## README

# Installation
> `npm install --save @types/multisort`

# Summary
This package contains type definitions for multisort (https://github.com/peterkhayes/multisort).

# Details
Files were exported from https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/multisort.
## [index.d.ts](https://github.com/DefinitelyTyped/DefinitelyTyped/tree/master/types/multisort/index.d.ts)
````ts
/**
 * Returns sorting function which sorts its argument by given criterions.
 * @param sortings Sort criterions.
 */
declare function multisort<T>(
    criterions: multisort.Criterion<T> | Array<multisort.Criterion<T>>,
): multisort.SortFunction<T>;

/**
 * Sorts given array by given criterions.
 * @param toSort Array to sort.
 * @param sortings Sort criterions.
 */
declare function multisort<T>(
    toSort: T[],
    criterions: multisort.Criterion<T> | Array<multisort.Criterion<T>>,
): T[];

declare namespace multisort {
    /**
     * Functional evaluators don't need any transformation, and can't
     *   have inverted order.
     *
     * Numerical evaluators sort the input directly if the criterion is
     *   non-negative, and in inverted order if the criterion is negative.
     *
     * String evaluators sort the input based on objects properties.
     * - Invert the sort if initial character is ! or ~.
     * - Allow an initial dot: ".prop.subprop" as well as "prop.subprop".
     * - Allow existential criterion by tailing question mark: "prop.subprop?".
     */
    type Criterion<T> = ((item: T) => any) | number | string;

    /**
     * Sorting function.
     */
    interface SortFunction<T> {
        (toSort: T[]): void;
        /**
         * To allow this to plug in to other sorting mechanisms.
         */
        comparator: (a: T, b: T) => number;
    }
}

export = multisort;

````

### Additional Details
 * Last updated: Tue, 07 Nov 2023 09:09:39 GMT
 * Dependencies: none

# Credits
These definitions were written by [Marek Buchar](https://github.com/CzBuCHi).

---
_Source: https://npm.io/package/@types/multisort · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
