README.md (1594B)
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 # isFunction 22 23 > Test if a value is a function. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var isFunction = require( '@stdlib/assert/is-function' ); 31 ``` 32 33 #### isFunction( value ) 34 35 Tests if a `value` is a `function`. 36 37 ```javascript 38 function beep() { 39 console.log( 'beep' ); 40 } 41 42 var bool = isFunction( beep ); 43 // returns true 44 ``` 45 46 </section> 47 48 <!-- /.usage --> 49 50 <section class="examples"> 51 52 ## Examples 53 54 <!-- eslint-disable no-empty-function, no-restricted-syntax --> 55 56 <!-- eslint no-undef: "error" --> 57 58 ```javascript 59 var isFunction = require( '@stdlib/assert/is-function' ); 60 61 var bool = isFunction( function foo() {} ); 62 // returns true 63 64 bool = isFunction( 'beep' ); 65 // returns false 66 67 bool = isFunction( 5 ); 68 // returns false 69 70 bool = isFunction( true ); 71 // returns false 72 73 bool = isFunction( null ); 74 // returns false 75 76 bool = isFunction( [] ); 77 // returns false 78 79 bool = isFunction( {} ); 80 // returns false 81 ``` 82 83 </section> 84 85 <!-- /.examples --> 86 87 <section class="links"> 88 89 </section> 90 91 <!-- /.links -->