Warning
This package is in early development. Don’t use it in production!
A modern way to generate code examples for different languages.
npm install @scalar/snippetz
import { snippetz } from '@scalar/snippetz'
const snippet = snippetz().print('node', 'undici', {
url: 'https://example.com'
})
/* Output */
// import { request } from 'undici'
//
// const { statusCode, body } = await request(
// 'https://example.com',
// )
import { snippetz } from '@scalar/snippetz'
const snippet = snippetz().plugins()
/* Output */
// [
// {
// target: 'node',
// client: 'undici',
// }
// ]
import { snippetz } from '@scalar/snippetz'
const snippet = snippetz().hasPlugin('node', 'undici')
/* Output */
// true
import { undici } from '@scalar/snippetz-plugin-undici'
const source = undici({
url: 'https://example.com'
})
console.log(source.code)
// import { request } from 'undici'
// const { statusCode, body } = await request(
// 'url': 'https://example.com',
// )
We are API nerds. You too? Let’s chat on Discord: https://discord.gg/8HeZcRGPFS
hanspagel |
marclave |
Contributions are welcome! Read CONTRIBUTING
.
The source code in this repository is licensed under MIT.