time-to-botec

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

README.md (2468B)


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