time-to-botec

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

README.md (2559B)


      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 # isInteger
     22 
     23 > Test if a value is a number having an integer value.
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var isInteger = require( '@stdlib/assert/is-integer' );
     31 ```
     32 
     33 #### isInteger( value )
     34 
     35 Tests if a value is a `number` having an `integer` value.
     36 
     37 <!-- eslint-disable no-new-wrappers -->
     38 
     39 ```javascript
     40 var Number = require( '@stdlib/number/ctor' );
     41 
     42 var bool = isInteger( 5.0 );
     43 // returns true
     44 
     45 bool = isInteger( new Number( 5.0 ) );
     46 // returns true
     47 
     48 bool = isInteger( -3.14 );
     49 // returns false
     50 
     51 bool = isInteger( null );
     52 // returns false
     53 ```
     54 
     55 #### isInteger.isPrimitive( value )
     56 
     57 Tests if a `value` is a primitive `number` having an `integer` value.
     58 
     59 <!-- eslint-disable no-new-wrappers -->
     60 
     61 ```javascript
     62 var Number = require( '@stdlib/number/ctor' );
     63 
     64 var bool = isInteger.isPrimitive( -3.0 );
     65 // returns true
     66 
     67 bool = isInteger.isPrimitive( new Number( -3.0 ) );
     68 // returns false
     69 ```
     70 
     71 #### isInteger.isObject( value )
     72 
     73 Tests if a `value` is a `Number` object having an `integer` value.
     74 
     75 <!-- eslint-disable no-new-wrappers -->
     76 
     77 ```javascript
     78 var Number = require( '@stdlib/number/ctor' );
     79 
     80 var bool = isInteger.isObject( 3.0 );
     81 // returns false
     82 
     83 bool = isInteger.isObject( new Number( 3.0 ) );
     84 // returns true
     85 ```
     86 
     87 </section>
     88 
     89 <!-- /.usage -->
     90 
     91 <section class="examples">
     92 
     93 ## Examples
     94 
     95 <!-- eslint-disable no-new-wrappers -->
     96 
     97 <!-- eslint no-undef: "error" -->
     98 
     99 ```javascript
    100 var Number = require( '@stdlib/number/ctor' );
    101 var isInteger = require( '@stdlib/assert/is-integer' );
    102 
    103 var bool = isInteger( -5.0 );
    104 // returns true
    105 
    106 bool = isInteger( 0.0 );
    107 // returns true
    108 
    109 bool = isInteger( new Number( 5.0 ) );
    110 // returns true
    111 
    112 bool = isInteger( 5.256 );
    113 // returns false
    114 
    115 bool = isInteger( 1.0/0.0 );
    116 // returns false
    117 
    118 bool = isInteger( -1.0/0.0 );
    119 // returns false
    120 
    121 bool = isInteger( '5' );
    122 // returns false
    123 
    124 bool = isInteger( null );
    125 // returns false
    126 ```
    127 
    128 </section>
    129 
    130 <!-- /.examples -->
    131 
    132 <section class="links">
    133 
    134 </section>
    135 
    136 <!-- /.links -->