Function: isLoopbackHost()
isLoopbackHost(
input):boolean
Whether input’s host is a loopback address - localhost, an IPv4
127.0.0.0/8 address, or IPv6 ::1 - i.e. a service running on this
machine (e.g. a local registry). Accepts anything urlBuilder
coerces (a URL string, URL, or { url }); returns false when the
input has no resolvable host.
Parameters
Section titled “Parameters”Returns
Section titled “Returns”boolean
Example
Section titled “Example”isLoopbackHost("http://localhost:4873"); // trueisLoopbackHost("http://127.0.0.1"); // trueisLoopbackHost("https://registry.npmjs.org"); // false