# hash-to-port

> Hash a value to a valid port

Latest version **1.2.0** (published 2020-11-29) · MIT license · 0 weekly downloads

## Install

```sh
npm install hash-to-port
pnpm add hash-to-port
yarn add hash-to-port
bun add hash-to-port
```

Provides the command `hash-to-port`.

## 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.2.0 |
| Published | 2020-11-29 |
| First published | 2015-10-08 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | none |
| Module format | CommonJS |
| Dependencies | 1 |
| Unpacked size | 4.1 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 35 |
| Author | Mathias Buus |
| Maintainers | mafintosh |

## Links

- npm: https://www.npmjs.com/package/hash-to-port
- Repository: https://github.com/mafintosh/hash-to-port
- Issues: https://github.com/mafintosh/hash-to-port/issues
- npm.io page: https://npm.io/package/hash-to-port

## Dependencies (1)

- [hash-index](https://npm.io/package/hash-index.md) ^3.0.0

## Recent versions

- 1.2.0 (latest) — 2020-11-29
- 1.1.0 — 2019-07-31
- 1.0.0 — 2015-10-08

## README

# hash-to-port

Hash a value to a valid port

```
npm install hash-to-port
```

[![build status](http://img.shields.io/travis/mafintosh/hash-to-port.svg?style=flat)](http://travis-ci.org/mafintosh/hash-to-port)

## Usage

``` js
var toPort = require('hash-to-port')

console.log(toPort('example.com')) // returns 22019
```

## API

#### `var port = toPort(value, ?from, ?to)`

Hash the given value to a valid port (`>= from <= to`).
The same value will *always* hash to the same port but note that two different values might hash to the same port as well

- `value` <string>
- `from` <?number> (default: `1024`)
- `to` <?number> (default: `65535`)

## License

MIT

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