time-to-botec

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

README.md (2136B)


      1 <!--
      2 
      3 @license Apache-2.0
      4 
      5 Copyright (c) 2021 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 # isArrowFunction
     22 
     23 > Test if a value is an [`arrow function`][mdn-arrow-function].
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var isArrowFunction = require( '@stdlib/assert/is-arrow-function' );
     31 ```
     32 
     33 #### isArrowFunction( value )
     34 
     35 Tests if a `value` is a an [`arrow function`][mdn-arrow-function] such as `( a, b ) => a + b`, `x => x`, or `( x ) => { return x*x; }`.
     36 
     37 <!-- eslint-disable func-style, no-restricted-syntax -->
     38 
     39 ```javascript
     40 var beep = () => {
     41     console.log( 'beep' );
     42 };
     43 
     44 var bool = isArrowFunction( beep );
     45 // returns true
     46 
     47 function boop() {
     48     console.log( 'boop' );
     49 }
     50 
     51 bool = isArrowFunction( boop );
     52 // returns false
     53 ```
     54 
     55 </section>
     56 
     57 <!-- /.usage -->
     58 
     59 <section class="examples">
     60 
     61 ## Examples
     62 
     63 <!-- eslint-disable func-style, no-restricted-syntax, no-empty-function -->
     64 
     65 <!-- eslint no-undef: "error" -->
     66 
     67 ```javascript
     68 var isArrowFunction = require( '@stdlib/assert/is-arrow-function' );
     69 
     70 var bool = isArrowFunction( () => {} );
     71 // returns true
     72 
     73 bool = isArrowFunction( function foo() {} );
     74 // returns false
     75 
     76 bool = isArrowFunction( 'beep' );
     77 // returns false
     78 
     79 bool = isArrowFunction( 5 );
     80 // returns false
     81 
     82 bool = isArrowFunction( true );
     83 // returns false
     84 
     85 bool = isArrowFunction( null );
     86 // returns false
     87 
     88 bool = isArrowFunction( [] );
     89 // returns false
     90 
     91 bool = isArrowFunction( {} );
     92 // returns false
     93 ```
     94 
     95 </section>
     96 
     97 <!-- /.examples -->
     98 
     99 <section class="links">
    100 
    101 [mdn-arrow-function]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Functions/Arrow_functions
    102 
    103 </section>
    104 
    105 <!-- /.links -->