time-to-botec

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

README.md (2100B)


      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 # isArrayLength
     22 
     23 > Test if a value is a valid array length.
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var isArrayLength = require( '@stdlib/assert/is-array-length' );
     31 ```
     32 
     33 #### isArrayLength( value )
     34 
     35 Tests if a value is a valid `array` length.
     36 
     37 ```javascript
     38 var bool = isArrayLength( 5 );
     39 // returns true
     40 
     41 bool = isArrayLength( -1 );
     42 // returns false
     43 
     44 bool = isArrayLength( 2.0e200 );
     45 // returns false
     46 
     47 bool = isArrayLength( 3.14 );
     48 // returns false
     49 
     50 bool = isArrayLength( null );
     51 // returns false
     52 ```
     53 
     54 </section>
     55 
     56 <!-- /.usage -->
     57 
     58 <section class="notes">
     59 
     60 ## Notes
     61 
     62 -   A valid `length` property for an [`Array`][mdn-array] is any integer value on the interval `[0, 2^32-1]`.
     63 
     64 </section>
     65 
     66 <!-- /.notes -->
     67 
     68 <section class="examples">
     69 
     70 ## Examples
     71 
     72 <!-- eslint no-undef: "error" -->
     73 
     74 ```javascript
     75 var isArrayLength = require( '@stdlib/assert/is-array-length' );
     76 
     77 var bool = isArrayLength( 5 );
     78 // returns true
     79 
     80 bool = isArrayLength( 0 );
     81 // returns true
     82 
     83 bool = isArrayLength( 2.0e200 );
     84 // returns false
     85 
     86 bool = isArrayLength( 5.256 );
     87 // returns false
     88 
     89 bool = isArrayLength( 1.0/0.0 );
     90 // returns false
     91 
     92 bool = isArrayLength( -1.0/0.0 );
     93 // returns false
     94 
     95 bool = isArrayLength( NaN );
     96 // returns false
     97 
     98 bool = isArrayLength( '5' );
     99 // returns false
    100 
    101 bool = isArrayLength( null );
    102 // returns false
    103 ```
    104 
    105 </section>
    106 
    107 <!-- /.examples -->
    108 
    109 <section class="links">
    110 
    111 [mdn-array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Array
    112 
    113 </section>
    114 
    115 <!-- /.links -->