Skip to content

Commit

Permalink
docs(core): update usage
Browse files Browse the repository at this point in the history
  • Loading branch information
kwaa committed May 22, 2024
1 parent abc9726 commit c22af34
Showing 1 changed file with 19 additions and 10 deletions.
29 changes: 19 additions & 10 deletions packages/core/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,14 +19,15 @@ import { process } from '@kkna/core'
import { mastodon } from '@kkna/preset-mastodon'

const result = await process({
data: {
mastodon: {
data: { ...data },
presets: [
mastodon({
// https://fosstodon.org/@importantimport/111211120931974745
id: '111211120931974745',
instance: 'https://fosstodon.org',
}
},
presets: [mastodon],
}),
...presets,
],
})

/** @type {import('@kkna/core').ProcessResult} */
Expand All @@ -36,11 +37,19 @@ console.log(result)
###### definePreset

```ts
import { definePreset } from '@kkna/core'

export const myPreset = definePreset<{ myPreset: MyPresetOptions }>(async ({ myPreset }) => ({
comments: { ...comments },
reactions: { ...reactions },
import { definePreset, definePresetTask } from '@kkna/core'

export interface Options extends Record<string, unknown> {
/* your options here */
}

export const example = definePreset<Options>(options => ({
name: 'example', // kkna-preset-example => example
options,
task: definePresetTask(async data => ({
comments: { ...comments },
reactions: { ...reactions },
}))
}))
```

Expand Down

0 comments on commit c22af34

Please sign in to comment.