time-to-botec

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

README.md (3376B)


      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 # isRangeError
     22 
     23 > Test if a value is a [RangeError][mdn-range-error] object.
     24 
     25 <!-- Section to include introductory text. Make sure to keep an empty line after the intro `section` element and another before the `/section` close. -->
     26 
     27 <section class="intro">
     28 
     29 </section>
     30 
     31 <!-- /.intro -->
     32 
     33 <!-- Package usage documentation. -->
     34 
     35 <section class="usage">
     36 
     37 ## Usage
     38 
     39 ```javascript
     40 var isRangeError = require( '@stdlib/assert/is-range-error' );
     41 ```
     42 
     43 #### isRangeError( value )
     44 
     45 Tests if a `value` is a [`RangeError`][mdn-range-error] object.
     46 
     47 ```javascript
     48 var bool = isRangeError( new RangeError( 'beep' ) );
     49 // returns true
     50 ```
     51 
     52 </section>
     53 
     54 <!-- /.usage -->
     55 
     56 <!-- Package usage notes. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
     57 
     58 <section class="notes">
     59 
     60 ## Notes
     61 
     62 -   This function should **not** be considered robust. While the function should **always** return `true` if provided a [`RangeError`][mdn-range-error] (or a descendant) object, false positives may occur due to the fact that the [`RangeError`][mdn-range-error] constructor inherits from [`Error`][mdn-error] and has no internal class of its own. Hence, [`RangeError`][mdn-range-error] impersonation is possible.
     63 
     64 </section>
     65 
     66 <!-- /.notes -->
     67 
     68 <!-- Package usage examples. -->
     69 
     70 <section class="examples">
     71 
     72 ## Examples
     73 
     74 <!-- eslint no-undef: "error" -->
     75 
     76 ```javascript
     77 var isRangeError = require( '@stdlib/assert/is-range-error' );
     78 
     79 var bool = isRangeError( new RangeError( 'range error' ) );
     80 // returns true
     81 
     82 bool = isRangeError( new Error( 'error' ) );
     83 // returns false
     84 
     85 bool = isRangeError( new EvalError( 'eval error' ) );
     86 // returns false
     87 
     88 bool = isRangeError( new ReferenceError( 'reference error' ) );
     89 // returns false
     90 
     91 bool = isRangeError( new SyntaxError( 'syntax error' ) );
     92 // returns false
     93 
     94 bool = isRangeError( new TypeError( 'type error' ) );
     95 // returns false
     96 
     97 bool = isRangeError( new URIError( 'URI error' ) );
     98 // returns false
     99 
    100 bool = isRangeError( {} );
    101 // returns false
    102 
    103 bool = isRangeError( null );
    104 // returns false
    105 ```
    106 
    107 </section>
    108 
    109 <!-- /.examples -->
    110 
    111 <!-- Section to include cited references. If references are included, add a horizontal rule *before* the section. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    112 
    113 <section class="references">
    114 
    115 </section>
    116 
    117 <!-- /.references -->
    118 
    119 <!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. -->
    120 
    121 <section class="links">
    122 
    123 [mdn-error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Error
    124 
    125 [mdn-range-error]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/RangeError
    126 
    127 </section>
    128 
    129 <!-- /.links -->