time-to-botec

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

README.md (3837B)


      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 # isUNCPath
     22 
     23 > Test if a value is a [UNC][unc] path.
     24 
     25 <section class="intro">
     26 
     27 </section>
     28 
     29 <!-- /.intro -->
     30 
     31 <section class="usage">
     32 
     33 ## Usage
     34 
     35 ```javascript
     36 var isUNCPath = require( '@stdlib/assert/is-unc-path' );
     37 ```
     38 
     39 #### isUNCPath( value )
     40 
     41 Tests if a `value` is a [UNC][unc] path.
     42 
     43 ```javascript
     44 var bool = isUNCPath( '\\\\server\\share\\foo\\bar\\baz' );
     45 // returns true
     46 
     47 bool = isUNCPath( '/foo/bar/baz' );
     48 // returns false
     49 ```
     50 
     51 </section>
     52 
     53 <!-- /.usage -->
     54 
     55 <section class="examples">
     56 
     57 ## Examples
     58 
     59 <!-- eslint no-undef: "error" -->
     60 
     61 ```javascript
     62 var isUNCPath = require( '@stdlib/assert/is-unc-path' );
     63 
     64 var bool;
     65 var path;
     66 
     67 path = '\\\\server\\share\\foo\\bar\\baz:a:b';
     68 bool = isUNCPath( path );
     69 // returns true
     70 
     71 path = '\\\\server\\share\\foo\\bar\\baz::b';
     72 bool = isUNCPath( path );
     73 // returns true
     74 
     75 path = '\\\\server\\share\\foo\\bar\\baz:a';
     76 bool = isUNCPath( path );
     77 // returns true
     78 
     79 path = '\\\\server\\share\\foo\\bar\\baz';
     80 bool = isUNCPath( path );
     81 // returns true
     82 
     83 path = '\\\\server\\share\\foo\\bar';
     84 bool = isUNCPath( path );
     85 // returns true
     86 
     87 path = '\\\\server\\share\\foo';
     88 bool = isUNCPath( path );
     89 // returns true
     90 
     91 path = '\\\\server\\share';
     92 bool = isUNCPath( path );
     93 // returns true
     94 
     95 path = '\\\\server\\\\share';
     96 bool = isUNCPath( path );
     97 // returns false
     98 
     99 path = '\\\\\\\\server\\share';
    100 bool = isUNCPath( path );
    101 // returns false
    102 
    103 path = 'beep boop \\\\server\\share';
    104 bool = isUNCPath( path );
    105 // returns false
    106 
    107 path = '\\\\server';
    108 bool = isUNCPath( path );
    109 // returns false
    110 
    111 path = '\\';
    112 bool = isUNCPath( path );
    113 // returns false
    114 
    115 path = '';
    116 bool = isUNCPath( path );
    117 // returns false
    118 
    119 path = '\\\\server\\share\\';
    120 bool = isUNCPath( path );
    121 // returns false
    122 
    123 path = '\\\\server\\share\\foo\\bar\\baz:';
    124 bool = isUNCPath( path );
    125 // returns false
    126 
    127 path = '\\\\server\\share\\foo\\bar\\baz:a:';
    128 bool = isUNCPath( path );
    129 // returns false
    130 
    131 path = '\\\\server\\share\\foo\\bar\\baz::';
    132 bool = isUNCPath( path );
    133 // returns false
    134 
    135 path = '\\\\server\\share\\foo\\bar\\baz:a:b:c';
    136 bool = isUNCPath( path );
    137 // returns false
    138 
    139 path = '\\\\server\\share\\foo\\bar\\';
    140 bool = isUNCPath( path );
    141 // returns false
    142 
    143 path = '//server/share';
    144 bool = isUNCPath( path );
    145 // returns false
    146 
    147 path = '/foo/bar';
    148 bool = isUNCPath( path );
    149 // returns false
    150 
    151 path = 'foo/bar';
    152 bool = isUNCPath( path );
    153 // returns false
    154 
    155 path = './foo/bar';
    156 bool = isUNCPath( path );
    157 // returns false
    158 
    159 path = '/foo/../bar';
    160 bool = isUNCPath( path );
    161 // returns false
    162 ```
    163 
    164 </section>
    165 
    166 <!-- /.examples -->
    167 
    168 * * *
    169 
    170 <section class="cli">
    171 
    172 ## CLI
    173 
    174 <section class="usage">
    175 
    176 ### Usage
    177 
    178 ```text
    179 Usage: is-unc-path [options] [<path>]
    180 
    181 Options:
    182 
    183   -h,    --help                Print this message.
    184   -V,    --version             Print the package version.
    185 ```
    186 
    187 </section>
    188 
    189 <!-- /.usage -->
    190 
    191 <section class="examples">
    192 
    193 ### Examples
    194 
    195 ```bash
    196 $ is-unc-path '\\\\server\\share\\foo'
    197 true
    198 ```
    199 
    200 To use as a [standard stream][standard-streams],
    201 
    202 ```bash
    203 $ echo -n '\\\\server\\share\\foo' | is-unc-path
    204 true
    205 ```
    206 
    207 </section>
    208 
    209 <!-- /.examples -->
    210 
    211 </section>
    212 
    213 <!-- /.cli -->
    214 
    215 <section class="links">
    216 
    217 [unc]: https://msdn.microsoft.com/en-us/library/gg465305.aspx
    218 
    219 [standard-streams]: https://en.wikipedia.org/wiki/Standard_streams
    220 
    221 </section>
    222 
    223 <!-- /.links -->