📦
Schema
  • Getting Started
  • Documents
    • Basics
      • Extend
    • Any
      • Label
      • Default
      • Required
      • Pipe
      • Validate
    • Array
      • Length
      • Max
      • Min
      • Items
    • Boolean
    • Date
      • Max
      • Min
    • Number
      • Max
      • Min
      • Multiple
      • Integer
      • Port
      • Positive
      • Precision
    • Object
      • Length
      • Max
      • Min
      • Keys
    • String
      • Alphanum
      • Credit Card
      • Email
      • Enum
      • IP Address
      • Length
      • Max
      • Min
      • Numeral
      • Regex
      • Token
  • Source Code
Powered by GitBook
On this page
  • IPv4 / IPv6
  • IPv4
  • IPv6

Was this helpful?

  1. Documents
  2. String

IP Address

Check if the value is an IP address

IPv4 / IPv6

Checks if the given string is an IP address regardless of version

import Schema from "@rapidom/schema";

const Validator = Schema.string().ip();

IPv4

Checks if the given string is an IPv4 address

import Schema from "@rapidom/schema";

const Validator = Schema.string().ip(4);

IPv6

Checks if the given string is an IPv6 address

import Schema from "@rapidom/schema";

const Validator = Schema.string().ip(6);
PreviousEnumNextLength

Last updated 3 years ago

Was this helpful?