@andreoneti/islocalhost

Verification if url is localhost or not.

Usage no npm install needed!

<script type="module">
  import andreonetiIslocalhost from 'https://cdn.skypack.dev/@andreoneti/islocalhost';
</script>

README

Is Localhost

Installation

npm i @andreoneti/islocalhost or yarn add @andreoneti/islocalhost

Use

const { isLocalhost } = require('@andreoneti/islocalhost');

isLocalhost("localhost");             // true
isLocalhost("127.0.0.1");             // true
isLocalhost("google.com");            // false

OR

import { isLocalhost } from '@andreoneti/islocalhost';

isLocalhost("localhost");             // true
isLocalhost("127.0.0.1");             // true
isLocalhost("google.com");            // false