time-to-botec

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

README.md (2002B)


      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 # isFalsy
     22 
     23 > Test if a value is falsy.
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var isFalsy = require( '@stdlib/assert/is-falsy' );
     31 ```
     32 
     33 #### isFalsy( value )
     34 
     35 Tests if a `value` is a value which translates to `false` when evaluated in a boolean context.
     36 
     37 ```javascript
     38 var bool = isFalsy( false );
     39 // returns true
     40 
     41 bool = isFalsy( '' );
     42 // returns true
     43 
     44 bool = isFalsy( 0 );
     45 // returns true
     46 
     47 bool = isFalsy( NaN );
     48 // returns true
     49 
     50 bool = isFalsy( null );
     51 // returns true
     52 
     53 bool = isFalsy( void 0 );
     54 // returns true
     55 
     56 bool = isFalsy( [] );
     57 // returns false
     58 ```
     59 
     60 </section>
     61 
     62 <!-- /.usage -->
     63 
     64 <section class="examples">
     65 
     66 ## Examples
     67 
     68 <!-- eslint-disable no-empty-function, no-restricted-syntax -->
     69 
     70 <!-- eslint no-undef: "error" -->
     71 
     72 ```javascript
     73 var isFalsy = require( '@stdlib/assert/is-falsy' );
     74 
     75 var bool = isFalsy( false );
     76 // returns true
     77 
     78 bool = isFalsy( 0 );
     79 // returns true
     80 
     81 bool = isFalsy( NaN );
     82 // returns true
     83 
     84 bool = isFalsy( '' );
     85 // returns true
     86 
     87 bool = isFalsy( void 0 );
     88 // returns true
     89 
     90 bool = isFalsy( null );
     91 // returns true
     92 
     93 bool = isFalsy( 'beep' );
     94 // returns false
     95 
     96 bool = isFalsy( 5 );
     97 // returns false
     98 
     99 bool = isFalsy( true );
    100 // returns false
    101 
    102 bool = isFalsy( [] );
    103 // returns false
    104 
    105 bool = isFalsy( {} );
    106 // returns false
    107 
    108 bool = isFalsy( function foo() {} );
    109 // returns false
    110 ```
    111 
    112 </section>
    113 
    114 <!-- /.examples -->
    115 
    116 <section class="links">
    117 
    118 </section>
    119 
    120 <!-- /.links -->