GithubHelp home page GithubHelp logo

taniaserhiienko / js_validate_email Goto Github PK

View Code? Open in Web Editor NEW

This project forked from mate-academy/js_validate_email

0.0 0.0 0.0 150 KB

License: GNU General Public License v3.0

JavaScript 100.00%

js_validate_email's Introduction

Write tests for the validateEmail function, which takes the email string and returns true for valid email, and false for invalid.

An email is a string (a subset of ASCII characters) separated into two parts by @ symbol, a "personal_info" and a domain, that is personal_info@domain.

The personal_info part contains the following ASCII characters.

  • English letters (Aa-Zz)
  • digits
  • characters: ! $ % & ' * + - / = ? ^ _ { | } ~
  • character . ( period, dot or fullstop) provided that it is not the first or last character and it will not come one after the other.
  • @ is required
  • personal_info and domain can not start with dot .
  • double dots are not allowed in personal_info part

The domain name part contains letters, digits, hyphens, and dots.

The function does not check the uniqueness of the email (it happens during the request to DB) and the length of the email (it made by another function).

Examples:

validateEmail('[email protected]') === true
validateEmail('[email protected]') === true
validateEmail('false@email') === false

Hint: focus on the most priority and realistic cases, do not focus on edge cases.

Guideline

Read more about Jest expectations

js_validate_email's People

Contributors

ibrianwarner avatar tnboyko avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.