# is-my-ip-valid

> A small lib to validate IP addresses.

Latest version **1.0.1** (published 2022-03-01) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-my-ip-valid
pnpm add is-my-ip-valid
yarn add is-my-ip-valid
bun add is-my-ip-valid
```

## Health

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

Positive: no vulnerabilities.

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

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 1.0.1 |
| Published | 2022-03-01 |
| First published | 2018-02-14 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 0 |
| Unpacked size | 20.6 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 8 |
| Maintainers | linusu |

## Links

- npm: https://www.npmjs.com/package/is-my-ip-valid
- Repository: https://github.com/LinusU/is-my-ip-valid
- Homepage: https://github.com/LinusU/is-my-ip-valid#readme
- Issues: https://github.com/LinusU/is-my-ip-valid/issues
- npm.io page: https://npm.io/package/is-my-ip-valid

## Recent versions

- 1.0.1 (latest) — 2022-03-01
- 1.0.0 — 2018-02-14

## README

# Is my IP valid

A small lib to validate IP addresses.

## Installation

```sh
npm install --save is-my-ip-valid
```

## Usage

```js
const validator = require('is-my-ip-valid')
const validate = validator()
const validate4 = validator({ version: 4 })
const validate6 = validator({ version: 6 })

console.log(validate('127.0.0.1'))
//=> true

console.log(validate4('127.0.0.1'))
//=> true

console.log(validate6('127.0.0.1'))
//=> false

console.log(validate('2001:0db8:85a3:0000:0000:8a2e:0370:7334'))
//=> true

console.log(validate4('2001:0db8:85a3:0000:0000:8a2e:0370:7334'))
//=> false

console.log(validate6('2001:0db8:85a3:0000:0000:8a2e:0370:7334'))
//=> true
```

## Acknowledgements

The code is mostly based on this wonderful library: [beaugunderson/ip-address](https://github.com/beaugunderson/ip-address)

All regexes used are audited for catastrophic backtracking by this module: [substack/safe-regex](https://github.com/substack/safe-regex)

---
_Source: https://npm.io/package/is-my-ip-valid · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
