0.2.4 • Published 8 months ago

@scalar/snippetz v0.2.4

Weekly downloads
-
License
MIT
Repository
github
Last release
8 months ago

Snippetz

Version Downloads License Discord

A modern way to generate HTTP request examples for different languages and libraries.

Check out some examples here

Installation

npm install @scalar/snippetz

Usage

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',
// )

API

Get all plugins

import { snippetz } from '@scalar/snippetz'

const snippet = snippetz().plugins()

/* Output */

// [
//   {
//     target: 'node',
//     client: 'undici',
//   }
// ]

Check if a plugin is loaded

import { snippetz } from '@scalar/snippetz'

const snippet = snippetz().hasPlugin('node', 'undici')

/* Output */

// true

Lean usage

You can also just use one specific plugin to keep your bundle size small.

import { undici } from '@scalar/snippetz/plugins/node/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',
// )

Community

We are API nerds. You too? Let’s chat on Discord: https://discord.gg/scalar

License

The source code in this repository is licensed under MIT.

0.2.4

8 months ago

0.2.3

9 months ago

0.2.2

9 months ago

0.2.0

10 months ago

0.1.6

1 year ago

0.1.5

1 year ago

0.1.4

1 year ago

0.1.3

2 years ago

0.1.2

2 years ago

0.1.1

2 years ago

0.1.0

2 years ago