README.md (2642B)
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 # isInt16Array 22 23 > Test if a value is an [Int16Array][mdn-int16array]. 24 25 <section class="usage"> 26 27 ## Usage 28 29 ```javascript 30 var isInt16Array = require( '@stdlib/assert/is-int16array' ); 31 ``` 32 33 #### isInt16Array( value ) 34 35 Tests if a value is an [`Int16Array`][mdn-int16array]. 36 37 ```javascript 38 var Int16Array = require( '@stdlib/array/int16' ); 39 40 var bool = isInt16Array( new Int16Array( 10 ) ); 41 // returns true 42 43 bool = isInt16Array( [] ); 44 // returns false 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 Int8Array = require( '@stdlib/array/int8' ); 59 var Uint8Array = require( '@stdlib/array/uint8' ); 60 var Uint8ClampedArray = require( '@stdlib/array/uint8c' ); 61 var Int16Array = require( '@stdlib/array/int16' ); 62 var Uint16Array = require( '@stdlib/array/uint16' ); 63 var Int32Array = require( '@stdlib/array/int32' ); 64 var Uint32Array = require( '@stdlib/array/uint32' ); 65 var Float32Array = require( '@stdlib/array/float32' ); 66 var Float64Array = require( '@stdlib/array/float64' ); 67 var isInt16Array = require( '@stdlib/assert/is-int16array' ); 68 69 var bool = isInt16Array( new Int16Array( 10 ) ); 70 // returns true 71 72 bool = isInt16Array( new Int8Array( 10 ) ); 73 // returns false 74 75 bool = isInt16Array( new Uint8Array( 10 ) ); 76 // returns false 77 78 bool = isInt16Array( new Uint8ClampedArray( 10 ) ); 79 // returns false 80 81 bool = isInt16Array( new Uint16Array( 10 ) ); 82 // returns false 83 84 bool = isInt16Array( new Int32Array( 10 ) ); 85 // returns false 86 87 bool = isInt16Array( new Uint32Array( 10 ) ); 88 // returns false 89 90 bool = isInt16Array( new Float32Array( 10 ) ); 91 // returns false 92 93 bool = isInt16Array( new Float64Array( 10 ) ); 94 // returns false 95 96 bool = isInt16Array( new Array( 10 ) ); 97 // returns false 98 99 bool = isInt16Array( {} ); 100 // returns false 101 102 bool = isInt16Array( null ); 103 // returns false 104 ``` 105 106 </section> 107 108 <!-- /.examples --> 109 110 <section class="links"> 111 112 [mdn-int16array]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/Int16Array 113 114 </section> 115 116 <!-- /.links -->