Socket
Socket
Sign inDemoInstall

github.com/polds/check

Package Overview
Dependencies
0
Alerts
File Explorer

Install Socket

Detect and block malicious and high-risk dependencies

Install

    github.com/polds/check

Package check is a validation library written in Go to validate many real world applications. Examples include: emails, zip codes, phone numbers, etc.


Version published

Readme

Source

check

Validation Library for Go. API Documentation on go.pkgdoc.org. Inspiration and partial port from is.js

Installation

go get github.com/polds/check

Usage

Credit Card

To check if a credit card is a valid card

check.CreditCard("4111111111111111").CardIs("Any") // Returns true

To validate if a card is a specific type of card (Supported cards: American Express, Visa, Discover, Mastercard)

check.CreditCard("4111111111111111").CardIs("MasterCard") // Returns false

To determine the merchant of credit card

check.CreditCard("4111111111111111").Merchant() // Returns Visa

Email

To validate an email address

check.Email("test@test.com").IsValid() // Returns true

Zip Code

To validate if a provided zip code matches a target country standard

check.Zip("83406").OfCountry("us") // Returns true

Issues

  • Email regex fails: user@[IPv6:2001:db8:1ff::a0b:dbd0], postbox@com, admin@mailserver1. Besides those examples, regex is RFC compliant.

FAQs

Last updated on 09 Mar 2014

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc