time-to-botec

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

README.md (2400B)


      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 # isStringArray
     22 
     23 > Test if a value is an array of strings.
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var isStringArray = require( '@stdlib/assert/is-string-array' );
     31 ```
     32 
     33 #### isStringArray( value )
     34 
     35 Tests if a `value` is an array of strings.
     36 
     37 <!-- eslint-disable no-new-wrappers -->
     38 
     39 ```javascript
     40 var bool = isStringArray( [ 'beep', new String('boop') ] );
     41 // returns true
     42 
     43 bool = isStringArray( [ 'beep', null ] );
     44 // returns false
     45 ```
     46 
     47 #### isStringArray.primitives( value )
     48 
     49 Tests if a `value` is an `array` containing **only** `string` primitives.
     50 
     51 <!-- eslint-disable no-new-wrappers -->
     52 
     53 ```javascript
     54 var bool = isStringArray.primitives( [ 'beep', 'boop' ] );
     55 // returns true
     56 
     57 bool = isStringArray.primitives( [ 'beep', new String('boop') ] );
     58 // returns false
     59 ```
     60 
     61 #### isStringArray.objects( value )
     62 
     63 Tests if a `value` is an `array` containing **only** `String` objects.
     64 
     65 <!-- eslint-disable no-new-wrappers -->
     66 
     67 ```javascript
     68 var bool = isStringArray.objects( [ new String('beep'), new String('boop') ] );
     69 // returns true
     70 
     71 bool = isStringArray.objects( [ 'beep', new String('boop') ] );
     72 // returns false
     73 ```
     74 
     75 </section>
     76 
     77 <!-- /.usage -->
     78 
     79 <section class="examples">
     80 
     81 ## Examples
     82 
     83 <!-- eslint-disable no-new-wrappers -->
     84 
     85 <!-- eslint no-undef: "error" -->
     86 
     87 ```javascript
     88 var isStringArray = require( '@stdlib/assert/is-string-array' );
     89 
     90 var bool = isStringArray( [ 'Hello World!' ] );
     91 // returns true
     92 
     93 bool = isStringArray( [ 'a', 'b', 'c' ] );
     94 // returns true
     95 
     96 bool = isStringArray( [ new String( 'abc' ), 'def', 'ghi' ] );
     97 // returns true
     98 
     99 bool = isStringArray( 'abc' );
    100 // returns false
    101 
    102 bool = isStringArray( [] );
    103 // returns false
    104 
    105 bool = isStringArray( [ 'a', NaN ] );
    106 // returns false
    107 ```
    108 
    109 </section>
    110 
    111 <!-- /.examples -->
    112 
    113 <section class="links">
    114 
    115 </section>
    116 
    117 <!-- /.links -->