🔁 Check if it is a loopback network interface or not
- Supports TypeScript
- Supports both CommonJS and ESModules
$ npm install --save is-lo # for npm users
$ yarn add is-lo # for yarn usersThere are breaking changes in v1.0.0.
See the release note for more details.
import os from 'node:os'
import { isLo } from 'is-lo'
const interfaces = os.networkInterfaces()
const names = Object.keys(interfaces)
console.log(isLo(interfaces[names[0]])) // true or falseconst os = require('node:os')
const { isLo } = require('is-lo')
const interfaces = os.networkInterfaces()
const names = Object.keys(interfaces)
console.log(isLo(interfaces[names[0]])) // true or falsefamily(string):'IPv4'or'IPv6'address(string): IP address- Result (bool): true if it is loopback network interface
$ yarn test
$ yarn publish
MIT © Pine Mizune