Skip to content
This repository has been archived by the owner on Aug 28, 2024. It is now read-only.

Commit

Permalink
chore: update docs
Browse files Browse the repository at this point in the history
  • Loading branch information
hanspagel committed Dec 11, 2023
1 parent 5223b40 commit 71905fc
Showing 1 changed file with 14 additions and 18 deletions.
32 changes: 14 additions & 18 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
npm install @scalar/snippetz
```

## Quickstart
## Usage

```js
import { snippetz, undici } from '@scalar/snippetz'
Expand All @@ -20,51 +20,47 @@ const snippet = snippetz().get(
url: 'https://example.com'
})
)
```

<!-- ```js
import { format, print, undici } from '@scalar/snippetz'
const source = undici({
url: 'https://example.com'
})
console.log(format(print(source)))
``` -->

Output:
/* Output */

```
// import { request } from 'undici'
// const { statusCode, headers, trailers, body } = await request(
// 'https://example.com',
// )
```

## Usage
## API

### Generate an abstract tree (AST)

```js
import { undici } from '@scalar/snippetz'

const tree = undici({
const source = undici({
url: 'https://example.com'
})

console.log(source)
```

### Print the source code

```js
import { print } from '@scalar/snippetz'

const source = print(tree)
console.log(print({
target: 'js',
tree:
}))
```

### Format the source code

```js
import { format } from '@scalar/snippetz'

console.log(format(source))
console.log(format({
target: 'js',
tree:
}))
```

0 comments on commit 71905fc

Please sign in to comment.