Socket
Socket
Sign inDemoInstall

@deno.land/isip

Package Overview
Dependencies
Maintainers
1
Versions
1
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@deno.land/isip

IP address detector for Deno.


Version published
Weekly downloads
1
Maintainers
1
Weekly downloads
 
Created
Source

isIP

tag isIP-ci

IP address detector for Deno.

Usage

import { isIPv4, isIPv6, isIP } from "https://raw.githubusercontent.com/ako-deno/isIP/master/mod.ts";

isIPv4("192.168.0.2"); // true
isIPv4("168.0.2"); // false
isIPv4("2001:0db8:85a3:0000:0000:8a2e:0370:7334"); // false

isIPv6("2001:0db8:85a3:0000:0000:8a2e:0370:7334"); // true
isIPv6("2001:0db8:85a3:0000:0000:8a2e:0370"); // false
isIPv6("192.168.0.2"); // false

isIP("192.168.0.2"); // 4
isIP("168.0.2"); // 0
isIP("2001:0db8:85a3:0000:0000:8a2e:0370:7334"); // 6
isIP("2001:0db8:85a3:0000:0000:8a2e:0370"); // 0

API

  • isIPv4(input: string): boolean

    Returns true if input is a version 4 IP address, otherwise returns false. It should be compatible with Node.js' net.isIPv4.

  • isIPv6(input: string): boolean

    Returns true if input is a version 6 IP address, otherwise returns false. It should be compatible with Node.js' net.isIPv6.

  • isIP(input: string): number

    Tests if input is an IP address. Returns 0 for invalid strings, returns 4 for IP version 4 addresses, and returns 6 for IP version 6 addresses. It should be compatible with Node.js' net.isIP.

Any incompatibility, please check net_isip_test.ts

License

MIT

FAQs

Package last updated on 19 May 2020

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc