time-to-botec

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

README.md (2249B)


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