open-index/open-npm huggingface dataset:
npm package: @httpie/classes
Description: Class utilities for Node.js and JavaScript
Author: Patrick LUZOLO
Latest version: 1.5.0

<div align="center">
  <a href="https://httpiejs.com">
    <img width="471" style="max-width:100%;" src="https://httpiejs.com/images/httpie-text.svg" />
  </a>
  <br/>
  <br/>
  <p>
    <h3>Classes</h3>
  </p>
  <p>
    Class utilities for Node.js and JavaScript
  </p>
  <br/>
  <p>
    <a href="#installation"><strong>Installation</strong></a> ·
    <a href="#usage"><strong>Usage</strong></a> ·
    <a href="#api"><strong>API</strong></a>
  </p>
  <br/>
  <br/>
  <p>
    <a href="https://www.npmjs.com/package/@httpie/classes"><img src="https://img.shields.io/npm/v/@httpie/classes.svg" alt="Latest Version"></a>
    <a href="https://www.npmjs.com/package/@httpie/classes"><img src="https://img.shields.io/npm/dm/@httpie/classes.svg" alt="Monthly downloads"></a>
  </p>
  <p>
    <em>Follow <a href="http://twitter.com/eldorplus">@eldorplus</a> and <a href="http://twitter.com/httpiejs">@httpiejs</a> for updates!</em>
  </p>
</div>

---

## Introduction
The `@httpie/classes` package provides a handful methods around classes in Node.js and JavaScript. For example, determine whether a given input is a class using the `.isClass(input)` method.


## Installation

```
npm i @httpie/classes
```


## Usage
Using `@httpie/classes` is pretty straightforward. Install and import the package and use it right away:

```js
const { isClass } = require('@httpie/classes')

isClass(class Rabbit {})
// true

isClass(function classLikeRabbitFunc () {})
// false
```


## API

#### `isClass(input)`
Determine whether the given `input` is a class.

```js
const { isClass } = require('@httpie/classes')

isClass(class YourClass {})
// true
```


#### `isFunction(input)`
Determine whether the given `input` is a function.

```js
const { isFunction } = require('@httpie/classes')

isFunction(function sum () {})
// true
```


## Contributing
Do you miss a class-related function? We very much appreciate your contribution! Please send in a pull request 😊

1.  Create a fork
2.  Create your feature branch: `git checkout -b my-feature`
3.  Commit your changes: `git commit -am 'Add some feature'`
4.  Push to the branch: `git push origin my-new-feature`
5.  Submit a pull request 🚀


## License
MIT © [Supercharge](https://httpiejs.com)

---

> [httpiejs.com](https://httpiejs.com) &nbsp;&middot;&nbsp;
> GitHub [@httpie](https://github.com/httpie) &nbsp;&middot;&nbsp;
> Twitter [@httpiejs](https://twitter.com/httpiejs)
npm package: @httpie/command
Description: Build beautiful command line applications
Author: Patrick LUZOLO
Latest version: 1.2.0

<div align="center">
  <a href="https://httpiejs.com">
    <img width="471" style="max-width:100%;" src="https://httpiejs.com/images/httpie-text.svg" />
  </a>
  <br/>
  <br/>
  <p>
    <h3>Command</h3>
  </p>
  <p>
    Build beautiful console applications.
  </p>
  <br/>
  <p>
    <a href="#installation"><strong>Installation</strong></a> ·
    <a href="#docs"><strong>Docs</strong></a> ·
    <a href="#api"><strong>API</strong></a>
  </p>
  <br/>
  <br/>
  <p>
    <a href="https://www.npmjs.com/package/@httpie/command"><img src="https://img.shields.io/npm/v/@httpie/command.svg" alt="Latest Version"></a>
    <a href="https://www.npmjs.com/package/@httpie/command"><img src="https://img.shields.io/npm/dm/@httpie/command.svg" alt="Monthly downloads"></a>
  </p>
  <p>
    <em>Follow <a href="http://twitter.com/patrickpoehls">@patrickpoehls</a> and <a href="http://twitter.com/httpiejs">@httpiejs</a> for updates!</em>
  </p>
</div>

---

## Introduction
The `@httpie/command` package allows you to create beautiful console applications.


## Installation

```
npm i @httpie/command
```


## Docs
Find all the [details for `@httpie/command` in the extensive HTTPie docs](https://httpiejs.com/docs/console).


## Usage
Using `@httpie/command` is pretty straightforward. The package exports a handful of methods that you can reach for when requiring the package:

```js
const { Application } = require('@httpie/command')

async function run () {
  const app = new Application('console-app-name')
  await app.run()
}
```


## Contributing
Do you miss a function? We very much appreciate your contribution! Please send in a pull request 😊

1.  Create a fork
2.  Create your feature branch: `git checkout -b my-feature`
3.  Commit your changes: `git commit -am 'Add some feature'`
4.  Push to the branch: `git push origin my-new-feature`
5.  Submit a pull request 🚀


## License
MIT © [HTTPie](https://httpiejs.com)

---

> [httpiejs.com](https://httpiejs.com) &nbsp;&middot;&nbsp;
> GitHub [@httpie](https://github.com/httpie) &nbsp;&middot;&nbsp;
> Twitter [@httpiejs](https://twitter.com/httpiejs)
npm package: @httpie/errors
Description: Useful JavaScript error classes
Author: Patrick LUZOLO
Latest version: 1.3.0

<div align="center">
  <a href="https://httpiejs.com">
    <img width="471" style="max-width:100%;" src="https://httpiejs.com/images/httpie-text.svg" />
  </a>
  <br/>
  <br/>
  <p>
    <h3>Errors</h3>
  </p>
  <p>
    JavaScript error classes with useful defaults
  </p>
  <br/>
  <p>
    <a href="#installation"><strong>Installation</strong></a> ·
    <a href="#quick-usage-overview"><strong>Usage</strong></a>
  </p>
  <br/>
  <br/>
  <p>
    <a href="https://www.npmjs.com/package/@httpie/errors"><img src="https://img.shields.io/npm/v/@httpie/errors.svg" alt="Latest Version"></a>
    <a href="https://www.npmjs.com/package/@httpie/errors"><img src="https://img.shields.io/npm/dm/@httpie/errors.svg" alt="Monthly downloads"></a>
  </p>
  <p>
    <em>Follow <a href="http://twitter.com/eldorplus">@eldorplus</a> and <a href="http://twitter.com/httpiejs">@httpiejs</a> for updates!</em>
  </p>
</div>

---

## Introduction
The `@httpie/errors` package provides error classes with useful defaults. This avoids the boilerplate of setting up a custom error class in different projects.

- provides an `Error` base class capturing the stack trace by default
- every error has a `name` property providing the error’s class name
- exposes an `HttpError` class with HTTP `status` and error `code` properties


## Installation

```
npm i @httpie/errors
```


## Quick Usage Overview
Using `@httpie/errors` is pretty straightforward. The package exports error classes that you can use like the native `Error` class.

```js
const { Error, HttpError } = require('@httpie/errors')

// works like the native `Error` class and also contains the stacktrace
throw new Error('your error message')

// the HTTP Error provides a fluent interface to customize the properties
throw new HttpError('Request validation failed')
  .withStatus(400)
  .withCode('E_YOUR_CUSTOM_ERROR_CODE')

// or create an HTTP error by passing all arguments to the constructor
throw new HttpError('Request validation failed', 400, 'E_YOUR_CUSTOM_ERROR_CODE')

```


## Contributing
Do you miss a function? We very much appreciate your contribution! Please send in a pull request 😊

1.  Create a fork
2.  Create your feature branch: `git checkout -b my-feature`
3.  Commit your changes: `git commit -am 'Add some feature'`
4.  Push to the branch: `git push origin my-new-feature`
5.  Submit a pull request 🚀


## License
MIT © [Supercharge](https://httpiejs.com)

---

> [httpiejs.com](https://httpiejs.com) &nbsp;&middot;&nbsp;
> GitHub [@httpie](https://github.com/httpie) &nbsp;&middot;&nbsp;
> Twitter [@httpiejs](https://twitter.com/httpiejs)
npm package: @httpie/http-errors
Description: An HTTP error class throwing with proper status codes
Author: Patrick LUZOLO
Latest version: 1.0.0

<div align="center">
  <a href="https://httpiejs.com">
    <img width="471" style="max-width:100%;" src="https://httpiejs.com/images/httpie-text.svg" />
  </a>
  <br/>
  <br/>
  <p>
    <h3>HTTP Errors</h3>
  </p>
  <p>
    An HTTP error class throwing with proper status codes
  </p>
  <br/>
  <p>
    <a href="#installation"><strong>Installation</strong></a> ·
    <a href="#quick-usage-overview"><strong>Usage</strong></a>
  </p>
  <br/>
  <br/>
  <p>
    <a href="https://www.npmjs.com/package/@httpie/http-errors"><img src="https://img.shields.io/npm/v/@httpie/http-errors.svg" alt="Latest Version"></a>
    <a href="https://www.npmjs.com/package/@httpie/http-errors"><img src="https://img.shields.io/npm/dm/@httpie/http-errors.svg" alt="Monthly downloads"></a>
  </p>
  <p>
    <em>Follow <a href="http://twitter.com/eldorplus">@eldorplus</a> and <a href="http://twitter.com/httpiejs">@httpiejs</a> for updates!</em>
  </p>
</div>

---

## Introduction
The `@httpie/http-errors` package provides an HTTP error class with useful defaults.

- provides an `HttpError` base class with defaults to throw proper HTTP errors
- the `HttpError` base class captures stack traces by default
- create your own HTTP error with custom HTTP status code, title, and error code


## Installation

```
npm i @httpie/http-errors
```


## Quick Usage Overview
Using `@httpie/http-errors` is pretty straightforward. The package exports the `HttpError` class that you can use like the native `Error` class.

```js
const { HttpError } = require('@httpie/http-errors')

// create an HTTP 400 BadRequest error yourself
throw new HttpError('invalid request input data', 400)

// … or throw using shortcut methods
throw HttpError.badRequest('Request validation failed')

// … or use a fluent interface to customize the properties
throw new HttpError('Request validation failed')
  .withStatus(400)
  .withCode('E_YOUR_CUSTOM_ERROR_CODE')
```


## Contributing
Do you miss a function? We very much appreciate your contribution! Please send in a pull request 😊

1.  Create a fork
2.  Create your feature branch: `git checkout -b my-feature`
3.  Commit your changes: `git commit -am 'Add some feature'`
4.  Push to the branch: `git push origin my-new-feature`
5.  Submit a pull request 🚀


## License
MIT © [Supercharge](https://httpiejs.com)

---

> [httpiejs.com](https://httpiejs.com) &nbsp;&middot;&nbsp;
> GitHub [@httpie](https://github.com/httpie) &nbsp;&middot;&nbsp;
> Twitter [@httpiejs](https://twitter.com/httpiejs)
npm package: @httpie/json
Description: Secure drop-in replacement for the global `JSON` object
Author: Patrick LUZOLO
Latest version: 1.1.0

<div align="center">
  <a href="https://httpiejs.com">
    <img width="471" style="max-width:100%;" src="https://httpiejs.com/images/httpie-text.svg" />
  </a>
  <br/>
  <br/>
  <p>
    <h3>JSON</h3>
  </p>
  <p>
    Secure drop-in replacement for the global `JSON` object with prototype pollution protection
  </p>
  <br/>
  <p>
    <a href="#installation"><strong>Installation</strong></a> ·
    <a href="#usage"><strong>Usage</strong></a>
  </p>
  <br/>
  <br/>
  <p>
    <a href="https://www.npmjs.com/package/@httpie/json"><img src="https://img.shields.io/npm/v/@httpie/json.svg" alt="Latest Version"></a>
    <a href="https://www.npmjs.com/package/@httpie/json"><img src="https://img.shields.io/npm/dm/@httpie/json.svg" alt="Monthly downloads"></a>
  </p>
  <p>
    <em>Follow <a href="http://twitter.com/eldorplus">@eldorplus</a> and <a href="http://twitter.com/httpiejs">@httpiejs</a> for updates!</em>
  </p>
</div>

---

## Introduction
The `@httpie/json` package is a drop-in replacement for the global `JSON` object. It protects JSON parsing against protoype pollution attacks.


## Installation

```
npm i @httpie/json
```


## Usage
Using `@httpie/json` is pretty straightforward. Use it the same way as you would use the `JSON` object:

```js
const JSON = require('@httpie/json')

const user = JSON.parse('{"name":"Supercharge"}')
// { name: 'Supercharge' }

const user = JSON.parse('{"name":"Supercharge", "__proto__": { "x": 1 }, "constructor": {"prototype": {"bar": "baz"} } }')
// { name: 'Supercharge' }


const json = JSON.stringify({ name: 'Supercharge' })
// '{"name":"Supercharge"}'
```


## Contributing
Do you miss a function? We very much appreciate your contribution! Please send in a pull request 😊

1.  Create a fork
2.  Create your feature branch: `git checkout -b my-feature`
3.  Commit your changes: `git commit -am 'Add some feature'`
4.  Push to the branch: `git push origin my-new-feature`
5.  Submit a pull request 🚀


## License
MIT © [Supercharge](https://httpiejs.com)

---

> [httpiejs.com](https://httpiejs.com) &nbsp;&middot;&nbsp;
> GitHub [@httpie](https://github.com/httpie) &nbsp;&middot;&nbsp;
> Twitter [@httpiejs](https://twitter.com/httpiejs)
npm package: @httpie/set
Description: An Array-aligned Set class and the one JavaScript should have shipped
Author: Patrick LUZOLO
Latest version: 2.1.0

<div align="center">
  <a href="https://httpiejs.com">
    <img width="471" style="max-width:100%;" src="https://httpiejs.com/images/httpie-text.svg" />
  </a>
  <br/>
  <br/>
  <p>
    <h3>Set</h3>
  </p>
  <p>
    An Array-aligned <code>Set</code> class and the one JavaScript should have shipped
  </p>
  <br/>
  <p>
    <a href="#installation"><strong>Installation</strong></a> ·
    <a href="#resources"><strong>Docs</strong></a> ·
    <a href="#quick-usage-overview"><strong>Usage</strong></a>
  </p>
  <br/>
  <br/>
  <p>
    <a href="https://www.npmjs.com/package/@httpie/set"><img src="https://img.shields.io/npm/v/@httpie/set.svg" alt="Latest Version"></a>
    <a href="https://www.npmjs.com/package/@httpie/set"><img src="https://img.shields.io/npm/dm/@httpie/set.svg" alt="Monthly downloads"></a>
  </p>
  <p>
    <em>Follow <a href="http://twitter.com/eldorplus">@eldorplus</a> and <a href="http://twitter.com/httpiejs">@httpiejs</a> for updates!</em>
  </p>
</div>

---

## Introduction
The `@httpie/set` package provides an improved [`Set`](https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Set) implementation.

- aligned with the `Array` class instead of `Map`
- provides helpful methods like `.map(callback)`, `.filter(callback)`, `.find(callback)`, `.isEmpty()`, and many more.
- compares values for `deep equality` and not `reference`
- it’s the `Set` class JavaScript should have shipped


## Installation

```
npm i @httpie/set
```


## Resources

- [Documentation](https://httpiejs.com/docs/set)


## Quick Usage Overview
Using `@httpie/set` is pretty straightforward. The package exports a `Set` class providing all methods to interact with the set.

```js
const Set = require('@httpie/set')

const users = new Set()

users.isEmpty() // true

users
  .add({ id: 1, name: 'Marcus' })
  .add({ id: 2, name: 'Norman' })
  .add({ id: 3, name: 'Christian' })

users.isNotEmpty() // true

const usernames = users.map(user => {
  return user.name
})
// [ 'Marcus', 'Norman', 'Christian' ]

const marcus = users.find(user => {
  return user.name === 'Marcus'
})
// { id: 1, name: 'Marcus' }
```


## Contributing
Do you miss a function? We very much appreciate your contribution! Please send in a pull request 😊

1.  Create a fork
2.  Create your feature branch: `git checkout -b my-feature`
3.  Commit your changes: `git commit -am 'Add some feature'`
4.  Push to the branch: `git push origin my-new-feature`
5.  Submit a pull request 🚀


## License
MIT © [Httpie](https://httpiejs.com)

---

> [httpiejs.com](https://httpiejs.com) &nbsp;&middot;&nbsp;
> GitHub [@httpie](https://github.com/httpie) &nbsp;&middot;&nbsp;
> Twitter [@httpiejs](https://twitter.com/httpiejs)
npm package: @httpie/strings
Description:  String utilities for Node.js and JavaScript
Author: Patrick LUZOLO
Latest version: 1.21.0

<div align="center">
  <a href="https://httpiejs.com">
    <img width="471" style="max-width:100%;" src="https://httpiejs.com/images/httpie-text.svg" />
  </a>
  <br/>
  <br/>
  <p>
    <h3>Strings</h3>
  </p>
  <p>
    String utilities for Node.js.
  </p>
  <br/>
  <p>
    <a href="#installation"><strong>Installation</strong></a> ·
    <a href="#Docs"><strong>Docs</strong></a> ·
    <a href="#usage"><strong>Usage</strong></a>
  </p>
  <br/>
  <br/>
  <p>
    <a href="https://www.npmjs.com/package/@httpie/strings"><img src="https://img.shields.io/npm/v/@httpie/strings.svg" alt="Latest Version"></a>
    <a href="https://www.npmjs.com/package/@httpie/strings"><img src="https://img.shields.io/npm/dm/@httpie/strings.svg" alt="Monthly downloads"></a>
  </p>
  <p>
    <em>Follow <a href="http://twitter.com/eldorplus">@eldorplus</a> and <a href="http://twitter.com/httpiejs">@httpiejs</a> for updates!</em>
  </p>
</div>

---

## Introduction
The `@httpie/strings` package provides chainable string utilities for Node.js and JavaScript. It’s a wrapper around JavaScript’s global `String` class providing a handful of useful methods, like `.title()`, `.strip()`, `.camel()`, and so on.


## Installation

```
npm i @httpie/strings
```


## Docs
Find all the [details for `@httpie/strings` in the extensive HTTPie docs](https://httpiejs.com/docs/strings).


## Usage
Using `@httpie/strings` is pretty straightforward. Pass a string to the imported Function and chain your desired methods to transform to string value to your needs.

For example, you may want to trim a string and then title-case it:

```js
const Str = require('@httpie/strings')

const title = Str('  HTTPie is sweet!').trim().title().get()

// title: "HTTPie Is Sweet!"
```

For every method in the chain that would return a string, the package returns an instance of iteself. This way, you can chain further methods. Call `.get()` to retrieve the actual JavaScript string.


## Contributing
Do you miss a string function? We very much appreciate your contribution! Please send in a pull request 😊

1.  Create a fork
2.  Create your feature branch: `git checkout -b my-feature`
3.  Commit your changes: `git commit -am 'Add some feature'`
4.  Push to the branch: `git push origin my-new-feature`
5.  Submit a pull request 🚀


## License
MIT © [HTTPie](https://httpiejs.com)

---

> [httpiejs.com](https://httpiejs.com) &nbsp;&middot;&nbsp;
> GitHub [@httpie](https://github.com/httpie) &nbsp;&middot;&nbsp;
> Twitter [@httpiejs](https://twitter.com/httpiejs)
npm package: @httpie/tsconfig
Description: Shareable TypeScript config
Author: Patrick LUZOLO
Latest version: 3.1.0

<div align="center">
  <a href="https://httpiejs.com">
    <img width="471" style="max-width:100%;" src="https://httpiejs.com/images/httpie-text.svg" />
  </a>
  <br/>
  <br/>
  <p>
    <h3>Httpie shareable TypeScript Config</h3>
  </p>
  <p>
    Shared TypeScript config for Httpie projects
  </p>
  <br/>
  <p>
    <a href="#installation"><strong>Installation</strong></a> ·
    <a href="#usage"><strong>Usage</strong></a>
  </p>
  <br/>
  <br/>
  <p>
    <a href="https://www.npmjs.com/package/@httpie/tsconfig"><img src="https://img.shields.io/npm/v/@httpie/tsconfig.svg" alt="Latest Version"></a>
    <a href="https://www.npmjs.com/package/@httpie/tsconfig"><img src="https://img.shields.io/npm/dm/@httpie/tsconfig.svg" alt="Monthly downloads">
  </p>
  <p>
    <em>Follow <a href="http://twitter.com/eldorplus">@eldorplus</a> and <a href="http://twitter.com/httpiejs">@httpiejs</a> for updates!</em>
  </p>
</div>

---

## Installation

```
npm i -D @httpie/tsconfig
```


## Targets

| Major Release | Node.js version |
| ------------- | --------------- |
| `3.x`         | `14.x`          |
| `2.x`         | `12.x`          |
| `1.x`         | `8.x`           |


## Usage
Create a `tsconfig.json` file in your project and extends the `@httpie/tsconfig` [TypeScript config](https://www.typescriptlang.org/docs/handbook/tsconfig-json.html):

### Basic Usage
When installed, configure your `tsconfig.json` like this:

```json
{
  "extends": "@httpie/tsconfig",
  "compilerOptions": {
    "outDir": "dist"
  }
}
```


### Refined Configuration
You can refine your `tsconfig.json` to your needs. Let’s say you want to target Node.js v14 instead of v12 (which is the default). Change your `compilerOptions` to this:

```json
{
  "extends": "@httpie/tsconfig",
  "display": "Node 14",

  "compilerOptions": {
    "outDir": "dist",
    "lib": ["es2020"],
    "target": "es2020",
  }
}
```

Customizing your `compilerOptions` when extending the `@httpie/tsconfig` package only overrides the listed properties. Every other option defined in the base configuration will be inherited.


## Contributing

1.  Create a fork
2.  Create your feature branch: `git checkout -b my-feature`
3.  Commit your changes: `git commit -am 'Add some feature'`
4.  Push to the branch: `git push origin my-new-feature`
5.  Submit a pull request 🚀


## License
MIT © [Httpie](https://httpiejs.com)

---

> [httpiejs.com](https://httpiejs.com) &nbsp;&middot;&nbsp;
> GitLab [@httpie](https://gitlab.com/httpiejs) &nbsp;&middot;&nbsp;
> Twitter [@httpiejs](https://twitter.com/httpiejs)
npm package: @httpie/utilities
Description: Utility functions for Node.js and JavaScript
Author: Patrick LUZOLO
Latest version: 1.10.0

<div align="center">
  <a href="https://httpiejs.com">
    <img width="471" style="max-width:100%;" src="https://httpiejs.com/images/httpie-text.svg" />
  </a>
  <br/>
  <br/>
  <p>
    <h3>utilities</h3>
  </p>
  <p>
    Helper and utility functions for Node.js.
  </p>
  <br/>
  <p>
    <a href="#installation"><strong>Installation</strong></a> ·
    <a href="#docs"><strong>Docs</strong></a> ·
    <a href="#api"><strong>API</strong></a>
  </p>
  <br/>
  <br/>
  <p>
    <a href="https://www.npmjs.com/package/@httpie/utilities"><img src="https://img.shields.io/npm/v/@httpie/utilities.svg" alt="Latest Version"></a>
    <a href="https://www.npmjs.com/package/@httpie/utilities"><img src="https://img.shields.io/npm/dm/@httpie/utilities.svg" alt="Monthly downloads"></a>
  </p>
  <p>
    <em>Follow <a href="http://twitter.com/marcuspoehls">@marcuspoehls</a> and <a href="http://twitter.com/httpiejs">@httpiejs</a> for updates!</em>
  </p>
</div>

---

## Introduction
The `@httpie/utilities` package provides a handful of useful helper functions for Node.js and JavaScript, like an async `tap` function.


## Installation

```
npm i @httpie/utilities
```


## Docs
Find all the [details for `@httpie/utilities` in the extensive httpie docs](https://httpiejs.com/docs/utilities).


## API
Using `@httpie/utilities` is pretty straightforward. The package exports a handful of methods that you can reach for when requiring the package:


#### tap(value, callback)
Returns the `value` after running the `callback`. The callback receives the value as an argument.

```js
const { tap } = require('@httpie/utilities')

return tap(await User.find(1), async (user) => {
  await user.subscribeToNewsletter()
})

// returns the user with ID 1
```


#### upon(value, callback)
Returns the result of the callback. The callback receives the value as an argument.

```js
const { upon } = require('@httpie/utilities')

return upon(await User.find(1), async (user) => {
  return user.email
})

// user@email.com
```


## Contributing
Do you miss a goodie function? We very much appreciate your contribution! Please send in a pull request 😊

1.  Create a fork
2.  Create your feature branch: `git checkout -b my-feature`
3.  Commit your changes: `git commit -am 'Add some feature'`
4.  Push to the branch: `git push origin my-new-feature`
5.  Submit a pull request 🚀


## License
MIT © [httpie](https://httpiejs.com)

---

> [httpiejs.com](https://httpiejs.com) &nbsp;&middot;&nbsp;
> GitHub [@httpie](https://github.com/httpie) &nbsp;&middot;&nbsp;
> Twitter [@httpiejs](https://twitter.com/httpiejs)
npm package: @httpland/corp-middleware
Description: HTTP cross-origin resource policy(CORP) middleware
Latest version: 1.0.0

# corp-middleware

[![deno land](http://img.shields.io/badge/available%20on-deno.land/x-lightgrey.svg?logo=deno)](https://deno.land/x/corp_middleware)
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/corp_middleware/mod.ts)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/httpland/corp-middleware)](https://github.com/httpland/corp-middleware/releases)
[![codecov](https://codecov.io/github/httpland/corp-middleware/branch/main/graph/badge.svg)](https://codecov.io/gh/httpland/corp-middleware)
[![GitHub](https://img.shields.io/github/license/httpland/corp-middleware)](https://github.com/httpland/corp-middleware/blob/main/LICENSE)

[![test](https://github.com/httpland/corp-middleware/actions/workflows/test.yaml/badge.svg)](https://github.com/httpland/corp-middleware/actions/workflows/test.yaml)
[![NPM](https://nodei.co/npm/@httpland/corp-middleware.png?mini=true)](https://nodei.co/npm/@httpland/corp-middleware/)

HTTP cross-origin resource policy(CORP) middleware.

Compliant with
[Fetch, 3.6. `Cross-Origin-Resource-Policy` header](https://fetch.spec.whatwg.org/#cross-origin-resource-policy-header).

## Middleware

For a definition of Universal HTTP middleware, see the
[http-middleware](https://github.com/httpland/http-middleware) project.

## Usage

Middleware adds the `Cross-Origin-Resource-Policy` header to the response.

```ts
import {
  corp,
  type Handler,
} from "https://deno.land/x/corp_middleware@$VERSION/mod.ts";
import { assert } from "https://deno.land/std/testing/asserts.ts";

declare const request: Request;
declare const handler: Handler;

const middleware = corp();
const response = await middleware(request, handler);

assert(response.headers.has("cross-origin-resource-policy"));
```

yield:

```http
Cross-Origin-Resource-Policy: same-origin
```

The default field value is `same-origin`.

## Policy

To change the corp policy, do the following:

```ts
import {
  corp,
} from "https://deno.land/x/corp_middleware@$VERSION/middleware.ts";

const middleware = corp("cross-origin");
```

yield:

```http
Cross-Origin-Resource-Policy: cross-origin
```

## Conditions

Middleware will execute if all of the following conditions are met:

- Response does not include `Cross-Origin-Resource-Policy` header

## Effects

Middleware may make changes to the following elements of the HTTP message.

- HTTP Headers
  - Cross-Origin-Resource-Policy

## API

All APIs can be found in the
[deno doc](https://doc.deno.land/https/deno.land/x/corp_middleware/mod.ts).

## License

Copyright © 2023-present [httpland](https://github.com/httpland).

Released under the [MIT](./LICENSE) license
npm package: @httpland/etag
Description: HTTP ETag utilities for standard Request and Response
Latest version: 1.0.0-beta.1

# etag

HTTP ETag utilities for standard `Request` and `Response`.

## Usage

Add `etag` field to HTTP Response header. Or, check the etag and return the
appropriate `304` HTTP response.

The ETag is computed from a hash of the `Response` body.

For the sake of immutability, we guarantee that the argument will not be
modified.

```ts
import { withEtag } from "https://deno.land/x/http_etag@$VERSION/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

const taggedResponse = await withEtag(
  new Request("http://localhost"),
  new Response("ok"),
);

assertEquals(taggedResponse.headers.get("etag"), "<body:FNV32:hash>");
```

## Supported algorithms

You can change the algorithm from the `algorithm` filed.

```ts
import { withEtag } from "https://deno.land/x/http_etag@$VERSION/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

const taggedResponse = await withEtag(
  new Request("http://localhost"),
  new Response("ok"),
  { algorithm: "SHA-1" },
);

assertEquals(taggedResponse.headers.get("etag"), "<body:SHA-1:hash>");
```

The following algorithms are supported built-in.

- BLAKE2B
- BLAKE2B-256
- BLAKE2B-384
- BLAKE2S
- BLAKE3
- KECCAK-224
- KECCAK-256
- KECCAK-384
- KECCAK-512
- SHA-1
- SHA-224
- SHA-256
- SHA-384
- SHA-512
- SHA3-224
- SHA3-256
- SHA3-384
- SHA3-512
- SHAKE128
- SHAKE256
- TIGER
- RIPEMD-160
- MD4
- MD5
- FNV32(Default)
- FNV32A
- FNV64
- FNV64A

## License

Copyright © 2023-present [httpland](https://github.com/httpland).

Released under the [MIT](./LICENSE) license
npm package: @httpland/hsts-parser
Description: HTTP Strict Transport Security(HSTS) header field parser
Latest version: 1.0.0-beta.1

# hsts-parser

[![deno land](http://img.shields.io/badge/available%20on-deno.land/x-lightgrey.svg?logo=deno)](https://deno.land/x/hsts_parser)
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/hsts_parser/mod.ts)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/httpland/hsts-parser)](https://github.com/httpland/hsts-parser/releases)
[![codecov](https://codecov.io/github/httpland/hsts-parser/branch/main/graph/badge.svg)](https://codecov.io/gh/httpland/hsts-parser)
[![GitHub](https://img.shields.io/github/license/httpland/hsts-parser)](https://github.com/httpland/hsts-parser/blob/main/LICENSE)

[![test](https://github.com/httpland/hsts-parser/actions/workflows/test.yaml/badge.svg)](https://github.com/httpland/hsts-parser/actions/workflows/test.yaml)
[![NPM](https://nodei.co/npm/@httpland/hsts-parser.png?mini=true)](https://nodei.co/npm/@httpland/hsts-parser/)

HTTP Strict Transport Security(HSTS) header field parser.

Compliant with
[RFC 6797, 6.1. Strict-Transport-Security HTTP Response Header Field](https://www.rfc-editor.org/rfc/rfc6797#section-6.1).

## Strict Transport Security

`StrictTransportSecurity` is a structured object of `Strict-Transport-Security`
header .

| Name              | Type      |      Required      | Description                                                                                               |
| ----------------- | --------- | :----------------: | --------------------------------------------------------------------------------------------------------- |
| maxAge            | `number`  | :white_check_mark: | The number of seconds, after the reception of the STS header field, during which the UA regards the host. |
| includeSubDomains | `boolean` |         -          | Whether the rule applies to all subdomains or not.                                                        |
| preload           | `boolean` |         -          | Whether the domain do preload or not.                                                                     |

## Serialization

Serializes [Strict Transport Security](#strict-transport-security) into string.

```ts
import { stringify } from "https://deno.land/x/hsts_parser@$VERSION/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

assertEquals(
  stringify({
    maxAge: 60 * 60 * 24 * 180,
    includeSubDomains: true,
    preload: true,
  }),
  "max-age=15552000; includeSubDomains; preload",
);
```

### Throwing error

Throws `TypeError` if [Strict Transport Security](#strict-transport-security)
contains errors.

```ts
import { stringify } from "https://deno.land/x/hsts_parser@$VERSION/mod.ts";
import { assertThrows } from "https://deno.land/std/testing/asserts.ts";

assertThrows(() => stringify({ maxAge: NaN }));
```

## License

Copyright © 2023-present [httpland](https://github.com/httpland).

Released under the [MIT](./LICENSE) license
npm package: @httpland/http-cache-control
Description: HTTP Cache-Control header middleware for standard request and response
Latest version: 1.0.0-beta.1

# http-cache-control

HTTP `Cache-Control` header middleware for standard `Request` and `Response`.

## What

Middleware for HTTP `Content-Control` headers.

Assists in defining type-safe cache directives and safely adds `Cache-Control`
headers.

Compliant:

- [RFC 9111, 5.2. Cache-Control](https://www.rfc-editor.org/rfc/rfc9111.html#name-cache-control)
- [RFC 8246, HTTP Immutable Responses](https://www.rfc-editor.org/rfc/rfc8246.html)
- [RFC 5861, HTTP Cache-Control Extensions for Stale Content](https://www.rfc-editor.org/rfc/rfc5861)

## Middleware

For a definition of Universal HTTP middleware, see the
[http-middleware](https://github.com/httpland/http-middleware) project.

## Usage

Middleware factory is exported by default.

```ts
import cacheControl from "https://deno.land/x/http_cache_control@$VERSION/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

const middleware = cacheControl({
  "max-age": 604800,
  immutable: true,
  public: true,
});
declare const request: Request;
const handler = () => new Response("hello");

const response = await middleware(request, handler);

assertEquals(
  response.headers.get("cache-control"),
  "max-age=604800, immutable, public",
);
```

## Deep dive

If the `Response` already has a `Cache-Control` header, do nothing.

```ts
import cacheControl from "https://deno.land/x/http_cache_control@$VERSION/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

const middleware = cacheControl({
  "max-age": 604800,
  immutable: true,
  public: true,
});
declare const request: Request;
const handler = () =>
  new Response("hello", { headers: { "cache-control": "no-cache" } });

const response = await middleware(request, handler);

assertEquals(response.headers.get("cache-control"), "no-cache");
```

### Throwing error

If a number other than non-negative integer is specified, `AggregateError` will
be thrown.

```ts
import cacheControl from "https://deno.land/x/http_cache_control@$VERSION/mod.ts";
import { assertThrows } from "https://deno.land/std/testing/asserts.ts";

assertThrows(() => cacheControl({ "max-age": -100, "s-maxage": 1.1 }));
```

## License

Copyright © 2023-present [httpland](https://github.com/httpland).

Released under the [MIT](./LICENSE) license
npm package: @httpland/http-content-length
Description: HTTP Content-Length header middleware for standard request and response
Latest version: 1.0.0-beta.1

# http-content-length

HTTP `content-length` header middleware for standard `Request` and `Response`.

## What

Middleware for HTTP `content-length` headers.

[RFC 9110, 8.6 Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length)
compliant, safely add or remove `content-length` header.

## Middleware

For a definition of Universal HTTP middleware, see the
[http-middleware](https://github.com/httpland/http-middleware) project.

## Usage

Middleware is exported by default.

```ts
import contentLength from "https://deno.land/x/http_content_length@$VERSION/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

declare const request: Request;
const handler = () => new Response("hello");

const response = await contentLength(request, handler);

assertEquals(response.headers.get("content-length"), "5");
```

## Deep dive

Based on
[RFC 9110, 8.6 Content-Length](https://www.rfc-editor.org/rfc/rfc9110.html#name-content-length),
it is guaranteed that there is no `content-length` header in the `Response`.

- If the `Response` status code is informational(1XX).
- If the `Response` status code is no content(204).
- If HTTP request method is `CONNECT` and `Response` status code is
  successful(2XX).

Otherwise, it is guaranteed that the `content-length` header is in the
`Response`.

## License

Copyright © 2023-present [httpland](https://github.com/httpland).

Released under the [MIT](./LICENSE) license
npm package: @httpland/http-cors
Description: CORS middleware for standard Request and Response
Latest version: 1.0.0-beta.1

# http-cors

CORS middleware for standard `Request` and `Response`.

## Middleware

For a definition of Universal HTTP middleware, see the
[http-middleware](https://github.com/httpland/http-middleware) project.

## Usage

Middleware is exported by default.

In this example, the `access-control-allow-origin` header will add in the case
of a CORS request.

```ts
import cors from "https://deno.land/x/http_cors@$VERSION/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

const middleware = cors();
const response = await middleware(
  new Request("http://api.test", { headers: { origin: "http://cors.test" } }),
  (request) => new Response("ok"),
);
assertEquals(response.headers.get("access-control-allow-origin"), "*");
```

It also returns a `Request` for CORS Preflight in the case of a CORS Preflight
request.

```ts
import cors from "https://deno.land/x/http_cors@$VERSION/mod.ts";
import { assertEquals } from "https://deno.land/std/testing/asserts.ts";

const preflightRequest = new Request("http://api.test", {
  method: "OPTIONS",
  headers: {
    origin: "http://cors.test",
    "access-control-request-method": "POST",
    "access-control-request-headers": "content-type",
  },
});
const middleware = cors();
const response = await middleware(
  preflightRequest,
  (request) => new Response("ok"),
);

assertEquals(response.status, 204);
assertEquals(await response.text(), "");
assertEquals(response.headers.get("access-control-allow-origin"), "*");
```

## License

Copyright © 2023-present [httpland](https://github.com/httpland).

Released under the [MIT](./LICENSE) license
npm package: @httpland/http-middleware
Description: HTTP middleware specification
Latest version: 1.0.0

# http-middleware

HTTP middleware specification

## What

Define standard HTTP middleware specifications. This is intended to increase the
interoperability of the HTTP library's own middleware.

It consists only of the web standards stack and is compatible with many
browsers.

## Terms

<dl>
<dt>Upstream</dt>
<dd>Refers to HTTP requests forwarded from the client to the server.</dd>

<dt>Downstream</dt>
<dd>Refers to the HTTP response forwarded from the server to the client.</dd>
</dl>

## Interface

Middleware interfaces can be defined in TypeScript as follows:

```ts
interface Middleware {
  (request: Request, next: Handler): Response | Promise<Response>;
}

interface Handler {
  (request: Request): Response | Promise<Response>;
}
```

## Features

`Middleware` has the following features:

- Compliant with [Fetch API](https://fetch.spec.whatwg.org/).
- Compliant with `Handler`.

  `Handler` is a powerful interface for handling HTTP requests. The `Middleware`
  is purely an extension and compatibility with `Handler`.

- It is a pure function.

  `Middleware` is a pure function that returns a value. Implementations are
  expected to have no side effects.
- It is self-contained.
- It can handle upstream.
- It can handle downstream.
- It can handle next handler.

## Implementation

See [chain-handler](https://github.com/httpland/chain-handler) for a concrete
implementation that can handle middleware

## License

Copyright © 2023-present [httpland](https://github.com/httpland).

Released under the [MIT](./LICENSE) license
npm package: @httpland/xcto-middleware
Description: HTTP XCTO(X-Content-Type-Options) middleware
Latest version: 1.0.0

# xcto-middleware

[![deno land](http://img.shields.io/badge/available%20on-deno.land/x-lightgrey.svg?logo=deno)](https://deno.land/x/xcto_middleware)
[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/xcto_middleware/mod.ts)
[![GitHub release (latest by date)](https://img.shields.io/github/v/release/httpland/xcto-middleware)](https://github.com/httpland/xcto-middleware/releases)
[![codecov](https://codecov.io/github/httpland/xcto-middleware/branch/main/graph/badge.svg)](https://codecov.io/gh/httpland/xcto-middleware)
[![GitHub](https://img.shields.io/github/license/httpland/xcto-middleware)](https://github.com/httpland/xcto-middleware/blob/main/LICENSE)

[![test](https://github.com/httpland/xcto-middleware/actions/workflows/test.yaml/badge.svg)](https://github.com/httpland/xcto-middleware/actions/workflows/test.yaml)
[![NPM](https://nodei.co/npm/@httpland/xcto-middleware.png?mini=true)](https://nodei.co/npm/@httpland/xcto-middleware/)

HTTP XCTO(`X-Content-Type-Options`) middleware.

Compliant with
[Fetch, 3.5. `X-Content-Type-Options` header](https://fetch.spec.whatwg.org/#x-content-type-options-header).

## Middleware

For a definition of Universal HTTP middleware, see the
[http-middleware](https://github.com/httpland/http-middleware) project.

## Usage

Middleware adds the `X-Content-Type-Options` header to the response.

```ts
import {
  type Handler,
  xcto,
} from "https://deno.land/x/xcto_middleware@$VERSION/mod.ts";
import { assert } from "https://deno.land/std/testing/asserts.ts";

declare const request: Request;
declare const handler: Handler;

const middleware = xcto();
const response = await middleware(request, handler);

assert(response.headers.has("x-content-type-options"));
```

yield:

```http
X-Content-Type-Options: nosniff
```

## Conditions

Middleware is executed if all of the following conditions are met:

- Response does not include `X-Content-Type-Options` header

## Effects

Middleware may make changes to the following elements of the HTTP message.

- HTTP Headers
  - X-Content-Type-Options

## API

All APIs can be found in the
[deno doc](https://doc.deno.land/https/deno.land/x/xcto_middleware/mod.ts).

## License

Copyright © 2023-present [httpland](https://github.com/httpland).

Released under the [MIT](./LICENSE) license
npm package: @httptoolkit/osx-find-executable
Description: Find an app's executable by its bundle id
Latest version: 2.0.1

# osx-find-executable

> _Part of [HTTP Toolkit](https://httptoolkit.tech): powerful tools for building, testing & debugging HTTP(S)_

Find an app's executable on Mac.

This is a fork of https://github.com/juliangruber/osx-find-executable, which appears to now be unmaintained.

Key differences:
* This fork includes a fallback (manually searching the apps in /Applications) if Spotlight is disabled, instead of just claiming that all apps can't be found.
* This fork can also find an executable given a path to an app folder, not only using bundle id.
* This fork returns promises throughout, and doesn't use callbacks.
* This fork includes type definitions for TypeScript.

## Installation

```bash
$ npm install @httptoolkit/osx-find-executable
```

## Usage

```js
const { findExecutableById } = require('@httptoolkit/osx-find-executable')

findExecutableById('com.google.Chrome').then((exec) => {
  // => /Applications/Google Chrome.app/Contents/MacOS/Google Chrome
});
```

For more detailed examples, take a look at the tests in [test.js](https://github.com/httptoolkit/osx-find-executable/blob/master/test.js)


## API

### findExecutableById(id)

Takes a bundle id (like com.google.Chrome), finds the corresponding bundle on disk, and returns a promise for the path to the executable within.

### findExecutableInApp(appPath)

Takes a path to an app bundle (a .app directory, like /Applications/Google Chrome.app), and returns a promise for the path to the executable within.

## License

MIT
npm package: @httptoolkit/registry-js
Description: A simple and opinionated library for working with the Windows registry
Latest version: 1.9.1-node14

# registry-js

## A simple and opinionated library for working with the Windows registry

## Goals

* zero dependencies
* faster than `reg.exe`
* implement based on usage - don't replicate the registry API
* leverage TypeScript declarations wherever possible

**Note:** This is currently in preview, with support for features that GitHub
Desktop and Atom require.

## Install 

```shellsession
$ npm install --save registry-js
# or
$ yarn add registry-js
```

## But Why?

The current set of libraries for interacting with the registry have some
limitations that meant we couldn't use it in GitHub Desktop:

* [`windows-registry`](https://www.npmjs.com/package/windows-registry) depends
  on `ffi` at runtime, which caused issues with webpack-ing, and was missing
  APIs we needed.
* [`node-winreg`](https://www.npmjs.com/package/node-winreg) depends on
  `reg.exe` which breaks as soon as you enable "Prevent access to registry
  editing tools" Group Policy rules (yes, even `QUERY` operations are caught by
  this). More details about this can be found in
  [desktop/desktop#3105](https://github.com/desktop/desktop/issues/3105).

After exploring other options like invoking PowerShell - which was too slow - we
decided to write our own little library to do the stuff we require by invoking
the Win32 APIs directly.

## Documentation

See the documentation under the
[`docs`](https://github.com/desktop/registry-js/tree/master/docs) folder.

## Supported versions

Each release of `registry-js` includes prebuilt binaries for the versions of
Node and Electron that are actively supported by these projects. Please refer
to the release documentation for [Node](https://github.com/nodejs/Release) and
[Electron](https://electronjs.org/docs/tutorial/support) to see what is
supported currently.

## Contributing

Read the [Setup](https://github.com/desktop/registry-js/blob/master/docs/index.md#setup)
section to ensure your development environment is setup for what you need.

This project isn't about implementing a 1-1 replication of the Windows registry
API, but implementing just enough for whatever usages there are in the wild.

If you want to see something supported, open an issue to start a discussion
about it.