JSPM

ip-catchphrase

1.0.1
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 3
  • Score
    100M100P100Q21400F
  • License MIT

Convert IPv4 + port to and from a catchphrase

Package Exports

  • ip-catchphrase

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (ip-catchphrase) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

ip-catchphrase

Converts an IPv4 address (optionally with a port number) to and from a catchphrase.

Installation

# npm
npm install ip-catchphrase

#yarn
yarn add ip-catchphrase

Usage

Convert from IP address to catchphrase

const { getCatchphrase } = require("ip-catchphrase");

const catchphrase = getCatchphrase("192.168.0.1");
console.log(catchphrase); // 'runner rally still'

// Optionally specify a port number

const catchphrase2 = getCatchphrase("192.168.0.1", 25565);
console.log(catchphrase2); // 'runner rally day significance'

Convert from catchphrase to IP address

const { getAddress } = require("ip-catchphrase");

const catchphrase = getAddress("runner rally still");
console.log(catchphrase); // { address: '192.168.0.1', typos: [] }

// With a port number

const catchphrase2 = getAddress("runner rally day significance");
console.log(catchphrase2); // { address: '192.168.0.1', port: 25565, typos: [] }

// Typos are handled automatically

const catchphrase3 = getAddress("runner rally day significence");
console.log(catchphrase3); // { address: '192.168.0.1', port: 25565, typos: [...] }
console.log(catchphrase3.typos); // [{ original: 'significence', fixed: 'significance', confidence: 0.9166666666666666 }]

Credits

The word list used in this package is a processed version of http://www.desiquintans.com/nounlist