forked from keithamus/sort-package-json
-
Notifications
You must be signed in to change notification settings - Fork 0
/
index.d.ts
38 lines (31 loc) · 1.06 KB
/
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
34
35
36
37
38
/* eslint-disable @typescript-eslint/no-explicit-any */
declare namespace sortPackageJsonExports {
interface SortPackageJsonFn {
/**
* Sort packageJson object.
*
* @param packageJson - A packageJson
* @param options
* @returns Sorted packageJson object
*/
<T extends Record<any, any>>(packageJson: T, options?: Options): T,
/**
* Sort packageJson string.
*
* @param packageJson - A packageJson string.
* @param options
* @returns Sorted packageJson string.
*/
(packageJson: string, options?: Options): string,
}
type ComparatorFunction = (left: string, right: string) => number;
interface Options {
readonly sortOrder?: readonly string[] | ComparatorFunction;
}
}
interface sortPackageJsonExports extends sortPackageJsonExports.SortPackageJsonFn {
readonly default: sortPackageJsonExports.SortPackageJsonFn;
readonly sortPackageJson: sortPackageJsonExports.SortPackageJsonFn;
}
declare const sortPackageJsonExports: sortPackageJsonExports;
export = sortPackageJsonExports;