README.md (1425B)
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 # Identity Function 22 23 > Identity function. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var identity = require( '@stdlib/utils/identity-function' ); 31 ``` 32 33 #### identity( x ) 34 35 Returns `x`. 36 37 ```javascript 38 var v = identity( 3.14 ); 39 // returns 3.14 40 41 var input = []; 42 var output = identity( input ); 43 var bool = ( input === output ); 44 // returns true 45 ``` 46 47 </section> 48 49 <!-- /.usage --> 50 51 <section class="examples"> 52 53 ## Examples 54 55 <!-- eslint no-undef: "error" --> 56 57 ```javascript 58 var identity = require( '@stdlib/utils/identity-function' ); 59 60 var v = identity( 3.14 ); 61 // returns 3.14 62 63 v = identity( true ); 64 // returns true 65 66 v = identity( null ); 67 // returns null 68 69 v = identity( void 0 ); 70 // returns undefined 71 72 v = identity(); 73 // returns undefined 74 ``` 75 76 </section> 77 78 <!-- /.examples --> 79 80 <section class="links"> 81 82 </section> 83 84 <!-- /.links -->