time-to-botec

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

README.md (2141B)


      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 # Native Function
     22 
     23 > [Regular expression][regexp] to match a native function.
     24 
     25 <section class="usage">
     26 
     27 ## Usage
     28 
     29 ```javascript
     30 var reNativeFunction = require( '@stdlib/regexp/native-function' );
     31 ```
     32 
     33 #### reNativeFunction()
     34 
     35 Returns a [regular expression][regexp] to match a native `function`.
     36 
     37 ```javascript
     38 var RE_NATIVE_FUNCTION = reNativeFunction();
     39 var bool = RE_NATIVE_FUNCTION.test( Date.toString() );
     40 // returns true
     41 ```
     42 
     43 #### reNativeFunction.REGEXP
     44 
     45 [Regular expression][regexp] to match a native `function`.
     46 
     47 ```javascript
     48 var bool = reNativeFunction.REGEXP.test( Date.toString() );
     49 // returns true
     50 ```
     51 
     52 </section>
     53 
     54 <!-- /.usage -->
     55 
     56 <section class="examples">
     57 
     58 ## Examples
     59 
     60 <!-- eslint-disable no-restricted-syntax, no-empty-function, stdlib/no-builtin-math -->
     61 
     62 <!-- eslint no-undef: "error" -->
     63 
     64 ```javascript
     65 var Int8Array = require( '@stdlib/array/int8' );
     66 var reNativeFunction = require( '@stdlib/regexp/native-function' );
     67 
     68 var RE_NATIVE_FUNCTION = reNativeFunction();
     69 function isNativeFunction( fcn ) {
     70     return RE_NATIVE_FUNCTION.test( fcn.toString() );
     71 }
     72 
     73 var bool = isNativeFunction( Math.sqrt );
     74 // returns true
     75 
     76 bool = isNativeFunction( String );
     77 // returns true
     78 
     79 bool = isNativeFunction( Int8Array );
     80 // returns true
     81 
     82 bool = isNativeFunction( Date );
     83 // returns true
     84 
     85 bool = isNativeFunction( function noop() {} );
     86 // returns false
     87 ```
     88 
     89 </section>
     90 
     91 <!-- /.examples -->
     92 
     93 <section class="links">
     94 
     95 [regexp]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Guide/Regular_Expressions
     96 
     97 </section>
     98 
     99 <!-- /.links -->