time-to-botec

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

README.md (1996B)


      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 # isGeneratorObject
     22 
     23 > Test if a value is a [`generator`][mdn-generator-object] object.
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var isGeneratorObject = require( '@stdlib/assert/is-generator-object' );
     31 ```
     32 
     33 #### isGeneratorObject( value )
     34 
     35 Tests if a `value` is a [`generator`][mdn-generator-object] object.
     36 
     37 <!-- eslint-disable no-restricted-syntax -->
     38 
     39 ```javascript
     40 function* generateID() {
     41     var idx = 0;
     42     while ( idx < idx+1 ) {
     43         yield idx;
     44         idx += 1;
     45     }
     46 }
     47 
     48 var bool = isGeneratorObject( generateID() );
     49 // returns true
     50 
     51 bool = isGeneratorObject( generateID );
     52 // returns false
     53 
     54 bool = isGeneratorObject( {} );
     55 // returns false
     56 ```
     57 
     58 </section>
     59 
     60 <!-- /.usage -->
     61 
     62 <section class="examples">
     63 
     64 ## Examples
     65 
     66 <!-- eslint-disable no-restricted-syntax -->
     67 
     68 <!-- eslint no-undef: "error" -->
     69 
     70 ```javascript
     71 var isGeneratorObject = require( '@stdlib/assert/is-generator-object' );
     72 
     73 function* generator() {
     74     while ( true ) {
     75         yield 1.0;
     76     }
     77 }
     78 
     79 var bool = isGeneratorObject( generator() );
     80 // returns true
     81 
     82 bool = isGeneratorObject( {} );
     83 // returns false
     84 
     85 bool = isGeneratorObject( [] );
     86 // returns false
     87 
     88 bool = isGeneratorObject( null );
     89 // returns false
     90 ```
     91 
     92 </section>
     93 
     94 <!-- /.examples -->
     95 
     96 <section class="links">
     97 
     98 [mdn-generator-object]: https://developer.mozilla.org/de/docs/Web/JavaScript/Reference/Global_Objects/Generator
     99 
    100 </section>
    101 
    102 <!-- /.links -->