time-to-botec

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

README.md (2283B)


      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 # isAlphaNumeric
     22 
     23 > Test whether a string contains only alphanumeric characters.
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var isAlphaNumeric = require( '@stdlib/assert/is-alphanumeric' );
     31 ```
     32 
     33 #### isAlphaNumeric( value )
     34 
     35 Tests whether a string contains only alphanumeric characters.
     36 
     37 ```javascript
     38 var bool = isAlphaNumeric( 'abc0123456789' );
     39 // returns true
     40 ```
     41 
     42 </section>
     43 
     44 <!-- /.usage -->
     45 
     46 <section class="notes">
     47 
     48 ## Notes
     49 
     50 -   For non-string values, the function returns `false`.
     51 -   _Alphanumeric_ is defined as the characters `a-zA-Z` and the numeric characters `0-9`.
     52 
     53 </section>
     54 
     55 <!-- /.notes -->
     56 
     57 <section class="examples">
     58 
     59 ## Examples
     60 
     61 <!-- eslint no-undef: "error" -->
     62 
     63 ```javascript
     64 var isAlphaNumeric = require( '@stdlib/assert/is-alphanumeric' );
     65 
     66 var out = isAlphaNumeric( 'abs0123456789' );
     67 // returns true
     68 
     69 out = isAlphaNumeric( '0xffffff' );
     70 // returns true
     71 
     72 out = isAlphaNumeric( '' );
     73 // returns false
     74 
     75 out = isAlphaNumeric( 123 );
     76 // returns false
     77 ```
     78 
     79 </section>
     80 
     81 <!-- /.examples -->
     82 
     83 * * *
     84 
     85 <section class="cli">
     86 
     87 ## CLI
     88 
     89 <section class="usage">
     90 
     91 ### Usage
     92 
     93 ```text
     94 Usage: is-alphanumeric [options] [<string>]
     95 
     96 Options:
     97 
     98   -h,    --help                Print this message.
     99   -V,    --version             Print the package version.
    100 ```
    101 
    102 </section>
    103 
    104 <!-- /.usage -->
    105 
    106 <section class="examples">
    107 
    108 ### Examples
    109 
    110 ```bash
    111 $ is-alphanumeric 01abc23456789
    112 true
    113 ```
    114 
    115 To use as a [standard stream][standard-streams],
    116 
    117 ```bash
    118 $ echo -n '0123456789' | is-alphanumeric
    119 true
    120 ```
    121 
    122 </section>
    123 
    124 <!-- /.examples -->
    125 
    126 </section>
    127 
    128 <!-- /.cli -->
    129 
    130 <section class="links">
    131 
    132 [standard-streams]: https://en.wikipedia.org/wiki/Standard_streams
    133 
    134 </section>
    135 
    136 <!-- /.links -->