Skip to content

Commit

Permalink
doc: update README.md
Browse files Browse the repository at this point in the history
  • Loading branch information
jaywcjlove committed Jun 3, 2023
1 parent 8805c04 commit d4414be
Showing 1 changed file with 50 additions and 11 deletions.
61 changes: 50 additions & 11 deletions core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -165,14 +165,7 @@ export declare function findConfigFile(moduleName: string, root: string, searchP

## loader


### iniLoader

```ts
export declare function iniLoader<T>(_: string, content: string): T;
```

### jsLoader
### `.js`,`.ts`,`.cjs`,`.mjs`

```ts
import type { JITIOptions } from 'jiti/dist/types';
Expand Down Expand Up @@ -210,24 +203,70 @@ const data = load('namespace', {
});
```

### jsonLoader
example:

```ts
import { jsLoader } from 'auto-config-loader';
const data = jsLoader('/path/to/file/name.js')
```

### `.ini`

```ts
export declare function iniLoader<T>(_: string, content: string): T;
```

example:

```ts
import { iniLoader } from 'auto-config-loader';
const data = iniLoader(undefined, `...`)
```

### `.json`,`.jsonc`, `json5`

```ts
export declare function jsonLoader<T>(_: string, content: string): T;
```

### tomlLoader
example:

```ts
import { jsonLoader } from 'auto-config-loader';

const data = jsonLoader(undefined, `{ "a": 123 }`)
```

### `.toml`

```ts
export declare function tomlLoader<T>(_: string, content: string): T;
```

### yamlLoader
example:

```ts
import { tomlLoader } from 'auto-config-loader';

const data = tomlLoader(undefined, `...`)
```

### `.yaml`

```ts
export declare function yamlLoader<T>(_: string, content: string): T;
```

example:

```ts
import { yamlLoader } from 'auto-config-loader';

const data = yamlLoader(undefined, `...`)
```

## Custom `Yaml` loader

This is an example, the default `yaml`/`yml` does not require a loader.
Expand Down

0 comments on commit d4414be

Please sign in to comment.