Gathering detailed insights and metrics for is-localhost-ip
Gathering detailed insights and metrics for is-localhost-ip
Gathering detailed insights and metrics for is-localhost-ip
Gathering detailed insights and metrics for is-localhost-ip
private-ip
Check if IP address is private.
is-port-reachable
Check if a local or remote port is reachable
is-local-address
Static check if a hostname is a local IP address.
ip-request-limiter
A rate limiting middleware for Express applications using the client's IP address as the key. It is configurable with a maximum number of requests per hour and has an option to whitelist localhost requests. Built with TypeScript, it provides strong typing
Checks whether given host/DNS name or IPv4/IPv6 address belongs to the local machine
npm install is-localhost-ip
Typescript
Module System
Min. Node Version
Node Version
NPM Version
JavaScript (100%)
Total Downloads
0
Last Day
0
Last Week
0
Last Month
0
Last Year
0
MIT License
25 Stars
333 Commits
3 Forks
3 Watchers
6 Branches
4 Contributors
Updated on May 07, 2025
Latest Version
2.0.0
Package Id
is-localhost-ip@2.0.0
Unpacked Size
7.57 kB
Size
3.48 kB
File Count
5
NPM Version
8.11.0
Node Version
16.16.0
Cumulative downloads
Total Downloads
Last Day
0%
NaN
Compared to previous day
Last Week
0%
NaN
Compared to previous week
Last Month
0%
NaN
Compared to previous month
Last Year
0%
NaN
Compared to previous year
Comprehensive and robust library to checks whether given host name or IPv4/IPv6 address belongs to the local machine
Main difference from other libraries here is comprehensiveness: we start from strict RegExp checks (for IP address first, and then for correctness to be a host name), then fallback to DNS resolver (so it works with something like john.dev
remapped locally in hosts
or with local resolver).
All this in just ~100 lines of code without external dependencies.
1npm i is-localhost-ip 2# or 3yarn add is-localhost-ip
1const isLocalhost = require('is-localhost-ip'); 2 3(async () => { 4 await isLocalhost('127.0.0.1'); // true 5 await isLocalhost('::ffff:127.0.0.1'); // true 6 await isLocalhost('192.168.0.12'); // true 7 await isLocalhost('192.168.0.12', true); // true only if the local machine has an interface with that address 8 await isLocalhost('184.55.123.2'); // false 9 10 await isLocalhost('tino.local'); // true 11 await isLocalhost('localhost'); // true 12 await isLocalhost('microsoft.com'); // false 13})();
Doesn't work with internationalized (RFC 3492 or RFC 5891) domain names. If you need that please use wonderful Punycode.js to convert the string before passing to this library:
1const isLocalhost = require('is-localhost-ip'); 2const punycode = require('punycode'); 3 4(async () => { 5 await isLocalhost(punycode.toASCII('свобода.рф')); // false 6 await isLocalhost(punycode.toASCII('私の.家')); // true 7})();
is-localhost-ip
is available under the MIT license.
No vulnerabilities found.
Reason
no binaries found in the repo
Reason
no dangerous workflow patterns detected
Reason
license file detected
Details
Reason
dependency not pinned by hash detected -- score normalized to 5
Details
Reason
7 existing vulnerabilities detected
Details
Reason
detected GitHub workflow tokens with excessive permissions
Details
Reason
0 commit(s) and 0 issue activity found in the last 90 days -- score normalized to 0
Reason
no effort to earn an OpenSSF best practices badge detected
Reason
security policy file not detected
Details
Reason
project is not fuzzed
Details
Reason
SAST tool is not run on all commits -- score normalized to 0
Details
Score
Last Scanned on 2025-06-30
The Open Source Security Foundation is a cross-industry collaboration to improve the security of open source software (OSS). The Scorecard provides security health metrics for open source projects.
Learn More