# convict-format-with-validator_custom

> Formats 'email', 'ipaddress' and 'url' for convict

Latest version **6.2.0** (published 2023-02-17) · Apache-2.0 license · 0 weekly downloads

## Install

```sh
npm install convict-format-with-validator_custom
pnpm add convict-format-with-validator_custom
yarn add convict-format-with-validator_custom
bun add convict-format-with-validator_custom
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: no vulnerabilities.

Warnings: low downloads; no types; no esm support.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 6.2.0 |
| Published | 2023-02-17 |
| First published | 2023-02-17 |
| Weekly downloads | 0 |
| License | Apache-2.0 |
| TypeScript types | none |
| Module format | CommonJS |
| Node | >=6 |
| Dependencies | 1 |
| Unpacked size | 2.8 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 2374 |
| Author | Lloyd Hilaiel |
| Maintainers | nagasaipa-kore |
| Keywords | convict, convict-format, email, ipaddress, url, validator |

## Links

- npm: https://www.npmjs.com/package/convict-format-with-validator_custom
- Repository: https://github.com/mozilla/node-convict.git#master
- Homepage: https://github.com/mozilla/node-convict
- Issues: https://github.com/mozilla/node-convict/issues
- npm.io page: https://npm.io/package/convict-format-with-validator_custom

## Dependencies (1)

- [validator](https://npm.io/package/validator.md) ^13.7.0

## Alternatives

- [@expo/fingerprint](https://npm.io/package/@expo/fingerprint.md) — 6.2M weekly downloads
- [@azure/monitor-opentelemetry-exporter](https://npm.io/package/@azure/monitor-opentelemetry-exporter.md) — 850.0K weekly downloads
- [@azure/monitor-opentelemetry](https://npm.io/package/@azure/monitor-opentelemetry.md) — 624.0K weekly downloads
- [@posthog/ai](https://npm.io/package/@posthog/ai.md) — 423.3K weekly downloads
- [fakefilter](https://npm.io/package/fakefilter.md) — 63.9K weekly downloads

## Recent versions

- 6.2.0 (latest) — 2023-02-17

## README

# Convict-format-with-validator

[![NPM version](http://img.shields.io/npm/v/convict-format-with-validator.svg)](https://www.npmjs.org/package/convict-format-with-validator)

Formats `email`, `ipaddress` and `url` for convict with [validator.js](https://github.com/validatorjs/validator.js).


## Install

```shellsession
npm install convict-format-with-validator
```


## Usage

An example `config.js` file:

```javascript
const convict = require('convict');
const convict_format_with_validator = require('convict-format-with-validator');

// Add all formats
convict.addFormats(convict_format_with_validator);

// Or add only specific formats:
// convict.addFormat(convict_format_with_validator.ipaddress);
// etc.

// Define a schema
var config = convict({
  ip: {
    doc: 'The IP address to bind.',
    format: 'ipaddress',
    default: '127.0.0.1',
    env: 'IP_ADDRESS',
  },
  port: {
    doc: 'The port to bind.',
    format: 'port',
    default: 8080,
    env: 'PORT',
    arg: 'port'
  }
});
```

### Validation

Validation done through validator.js:

* `email`
* `ipaddress` - IPv4 and IPv6 addresses
* `url`

### Coercion

Convict will automatically coerce environmental variables from strings to their proper types when importing them.

---
_Source: https://npm.io/package/convict-format-with-validator_custom · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
