forked from keithamus/sort-package-json
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
33 lines (27 loc) · 876 Bytes
/
index.d.ts
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
/* eslint-disable @typescript-eslint/no-explicit-any */
type ComparatorFunction = (left: string, right: string) => number
interface Options {
readonly sortOrder?: readonly string[] | ComparatorFunction
}
interface SortPackageJson {
/**
* Sort packageJson object.
*
* @param packageJson - A packageJson
* @param options - An options object
* @returns Sorted packageJson object
*/
<T extends Record<any, any>>(packageJson: T, options?: Options): T
/**
* Sort packageJson string.
*
* @param packageJson - A packageJson string.
* @param options - An options object
* @returns Sorted packageJson string.
*/
(packageJson: string, options?: Options): string
}
declare const sortPackageJsonDefault: SortPackageJson
export default sortPackageJsonDefault
export const sortPackageJson: SortPackageJson
export const sortOrder: string[]