time-to-botec

Benchmark sampling in different programming languages
Log | Files | Refs | README

README.md (2574B)


      1 <!--
      2 
      3 @license Apache-2.0
      4 
      5 Copyright (c) 2018 The Stdlib Authors.
      6 
      7 Licensed under the Apache License, Version 2.0 (the "License");
      8 you may not use this file except in compliance with the License.
      9 You may obtain a copy of the License at
     10 
     11    http://www.apache.org/licenses/LICENSE-2.0
     12 
     13 Unless required by applicable law or agreed to in writing, software
     14 distributed under the License is distributed on an "AS IS" BASIS,
     15 WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
     16 See the License for the specific language governing permissions and
     17 limitations under the License.
     18 
     19 -->
     20 
     21 # isEmail
     22 
     23 > Test if a value is an email address.
     24 
     25 <section class="intro">
     26 
     27 </section>
     28 
     29 <!-- /.intro -->
     30 
     31 <section class="usage">
     32 
     33 ## Usage
     34 
     35 ```javascript
     36 var isEmail = require( '@stdlib/assert/is-email-address' );
     37 ```
     38 
     39 #### isEmail( value )
     40 
     41 Tests if a `value` is an [email address][validate-email-address].
     42 
     43 ```javascript
     44 var bool = isEmail( 'beep@boop.com' );
     45 // returns true
     46 ```
     47 
     48 </section>
     49 
     50 <!-- /.usage -->
     51 
     52 <section class="notes">
     53 
     54 ## Notes
     55 
     56 -   Validation is **not** rigorous, nor [should it be][validate-email-address]. **9** RFCs relate to email addresses, and accounting for all of them is a fool's errand. This module performs the simplest validation; i.e., requiring **at least** one `@` symbol.
     57 -   For rigorous validation, send a confirmation email. If the email bounces, consider the email invalid.
     58 
     59 <!-- </notes -->
     60 
     61 <section class="examples">
     62 
     63 ## Examples
     64 
     65 <!-- eslint no-undef: "error" -->
     66 
     67 ```javascript
     68 var isEmail = require( '@stdlib/assert/is-email-address' );
     69 
     70 var bool;
     71 
     72 bool = isEmail( 'beep@boop.com' );
     73 // returns true
     74 
     75 bool = isEmail( 'beep' );
     76 // returns false
     77 
     78 bool = isEmail( 'beep.com' );
     79 // returns false
     80 
     81 bool = isEmail( null );
     82 // returns false
     83 ```
     84 
     85 </section>
     86 
     87 <!-- /.examples -->
     88 
     89 * * *
     90 
     91 <section class="cli">
     92 
     93 ## CLI
     94 
     95 <section class="usage">
     96 
     97 ### Usage
     98 
     99 ```text
    100 Usage: is-email-address [options] [<string>]
    101 
    102 Options:
    103 
    104   -h,    --help                Print this message.
    105   -V,    --version             Print the package version.
    106 ```
    107 
    108 </section>
    109 
    110 <!-- /.usage -->
    111 
    112 <section class="examples">
    113 
    114 ### Examples
    115 
    116 ```bash
    117 $ is-email-address beep@boop.com
    118 true
    119 ```
    120 
    121 To use as a [standard stream][standard-streams],
    122 
    123 ```bash
    124 $ echo -n 'beep@boop.com' | is-email
    125 true
    126 ```
    127 
    128 </section>
    129 
    130 <!-- /.examples -->
    131 
    132 </section>
    133 
    134 <!-- /.cli -->
    135 
    136 <section class="links">
    137 
    138 [validate-email-address]: http://davidcel.is/posts/stop-validating-email-addresses-with-regex/
    139 
    140 [standard-streams]: https://en.wikipedia.org/wiki/Standard_streams
    141 
    142 </section>
    143 
    144 <!-- /.links -->