README.md (2285B)
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 # isStrictEqual 22 23 > Test if two arguments are strictly equal. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var isStrictEqual = require( '@stdlib/assert/is-strict-equal' ); 31 ``` 32 33 #### isStrictEqual( a, b ) 34 35 Tests if two arguments `a` and `b` are strictly equal. 36 37 ```javascript 38 var bool = isStrictEqual( false, false ); 39 // returns true 40 41 bool = isStrictEqual( '', '' ); 42 // returns true 43 44 bool = isStrictEqual( {}, {} ); 45 // returns false 46 47 bool = isStrictEqual( NaN, NaN ); 48 // returns false 49 ``` 50 51 In contrast to the strict equality operator `===`, the function distinguishes between `+0` and `-0`. 52 53 <!-- eslint-disable no-compare-neg-zero --> 54 55 ```javascript 56 var bool = ( 0.0 === -0.0 ); 57 // returns true 58 59 bool = isStrictEqual( 0.0, -0.0 ); 60 // returns false 61 62 bool = isStrictEqual( -0.0, -0.0 ); 63 // returns true 64 ``` 65 66 </section> 67 68 <!-- /.usage --> 69 70 <section class="examples"> 71 72 ## Examples 73 74 <!-- eslint no-undef: "error" --> 75 76 ```javascript 77 var isStrictEqual = require( '@stdlib/assert/is-strict-equal' ); 78 79 var bool = isStrictEqual( true, true ); 80 // returns true 81 82 bool = isStrictEqual( true, false ); 83 // returns false 84 85 bool = isStrictEqual( 'beep', 'beep' ); 86 // returns true 87 88 bool = isStrictEqual( 3.14, 3.14 ); 89 // returns true 90 91 bool = isStrictEqual( null, null ); 92 // returns true 93 94 bool = isStrictEqual( 0.0, 0.0 ); 95 // returns true 96 97 bool = isStrictEqual( -0.0, 0.0 ); 98 // returns false 99 100 bool = isStrictEqual( NaN, NaN ); 101 // returns false 102 103 bool = isStrictEqual( {}, {} ); 104 // returns false 105 106 bool = isStrictEqual( [], [] ); 107 // returns false 108 109 bool = isStrictEqual( isStrictEqual, isStrictEqual ); 110 // returns true 111 ``` 112 113 </section> 114 115 <!-- /.examples --> 116 117 <section class="links"> 118 119 </section> 120 121 <!-- /.links -->