is-lo
TypeScript icon, indicating that this package has built-in type declarations

1.0.0 • Public • Published

is-lo  npm build License

🔁 Check if it is a loopback network interface or not

Getting Started

$ npm install --save is-lo # for npm users
$ yarn add is-lo           # for yarn users

Features

  • Supports TypeScript
  • Supports both CommonJS and ESModules

Usage

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 false

Reference

isLo({ family: 'IPv4', address: '127.0.0.1' })

isLo([ { family: 'IPv4', address: '127.0.0.1' }, ... ])

  • family (string): 'IPv4' or 'IPv6'
  • address (string): IP address
  • Result (bool): true if it is loopback network interface

Development

Test

$ yarn test

Publish

$ yarn publish

License

MIT © Pine Mizune

Readme

Keywords

none

Package Sidebar

Install

npm i is-lo

Weekly Downloads

214

Version

1.0.0

License

MIT

Unpacked Size

7.34 kB

Total Files

8

Last publish

Collaborators

  • pine613