# seniority/lilconfig

> Every export of seniority/lilconfig, with its signature and doc comment: lilconfig, lilconfigSync, defaultLoadersSync, defaultLoaders, plus 11 types.

Source: https://seniority.interlace.tools/docs/api/lilconfig

<!-- Generated by scripts/api-reference.ts from the built dist/*.d.ts. Do not edit; run `npx tsx scripts/api-reference.ts`. -->

```ts
import { lilconfig, lilconfigSync, defaultLoadersSync, … } from 'seniority/lilconfig';
```

## Functions

### lilconfig

The async explorer. Its five keys, in this order, are asserted against cosmiconfig's.

```ts
function lilconfig(name: string, options?: Options): AsyncSearcher;
```

| Parameter | Type |
| :-- | :-- |
| `name` | `string` |
| `options` (optional) | `Options` |

**Returns** `AsyncSearcher`

### lilconfigSync

The sync explorer. Same walk, `fs.accessSync`/`fs.readFileSync`, and `require` for scripts.

```ts
function lilconfigSync(name: string, options?: OptionsSync): SyncSearcher;
```

| Parameter | Type |
| :-- | :-- |
| `name` | `string` |
| `options` (optional) | `OptionsSync` |

**Returns** `SyncSearcher`

## Constants

### defaultLoaders

lilconfig's async table: `import()` for the three script extensions, `JSON.parse` for data.

```ts
const defaultLoaders: Loaders;
```

### defaultLoadersSync

lilconfig's sync table. `.json` is `require`, not `JSON.parse` — that difference is graded.

```ts
const defaultLoadersSync: LoadersSync;
```

## Interfaces

### AsyncSearcher

```ts
interface AsyncSearcher extends ClearCaches {
    search: (searchFrom?: string) => Promise<LilconfigResult>;
    load: (filepath: string) => Promise<LilconfigResult>;
}
```

### Options

```ts
interface Options extends OptionsBase {
    loaders?: Loaders;
    transform?: Transform;
}
```

### OptionsSync

```ts
interface OptionsSync extends OptionsBase {
    loaders?: LoadersSync;
    transform?: TransformSync;
}
```

### SyncSearcher

```ts
interface SyncSearcher extends ClearCaches {
    search: (searchFrom?: string) => LilconfigResult;
    load: (filepath: string) => LilconfigResult;
}
```

## Types

### LilconfigResult

```ts
type LilconfigResult = null | {
    filepath: string;
    config: unknown;
    isEmpty?: boolean;
};
```

### Loader

```ts
type Loader = LoaderSync | ((filepath: string, content: string) => Promise<unknown>);
```

### Loaders

```ts
type Loaders = Record<string, Loader>;
```

### LoadersSync

```ts
type LoadersSync = Record<string, LoaderSync>;
```

### LoaderSync

```ts
type LoaderSync = (filepath: string, content: string) => unknown;
```

### Transform

```ts
type Transform = TransformSync | ((result: LilconfigResult) => Promise<LilconfigResult>);
```

### TransformSync

```ts
type TransformSync = (result: LilconfigResult) => LilconfigResult;
```
