|
| 1 | +<!-- |
| 2 | +
|
| 3 | +@license Apache-2.0 |
| 4 | +
|
| 5 | +Copyright (c) 2024 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 | +# isComplex128Array |
| 22 | + |
| 23 | +> Test if a value is a [`Complex128Array`][@stdlib/array/complex128]. |
| 24 | +
|
| 25 | +<section class="intro"> |
| 26 | + |
| 27 | +</section> |
| 28 | + |
| 29 | +<!-- ./intro --> |
| 30 | + |
| 31 | +<section class="usage"> |
| 32 | + |
| 33 | +## Usage |
| 34 | + |
| 35 | +```javascript |
| 36 | +var isComplex128Array = require( '@stdlib/array/base/assert/is-complex128array' ); |
| 37 | +``` |
| 38 | + |
| 39 | +#### isComplex128Array( value ) |
| 40 | + |
| 41 | +Tests if a value is a [`Complex128Array`][@stdlib/array/complex128]. |
| 42 | + |
| 43 | +```javascript |
| 44 | +var Complex128Array = require( '@stdlib/array/complex128' ); |
| 45 | + |
| 46 | +var arr = new Complex128Array( 10 ); |
| 47 | +var bool = isComplex128Array( arr ); |
| 48 | +// returns true |
| 49 | +``` |
| 50 | + |
| 51 | +</section> |
| 52 | + |
| 53 | +<!-- /.usage --> |
| 54 | + |
| 55 | +<section class="notes"> |
| 56 | + |
| 57 | +## Notes |
| 58 | + |
| 59 | +- This function is not robust and that is intentional. This function provides a lower cost way to reasonably determine whether an input value is a [`Complex128Array`][@stdlib/array/complex128] in order to avoid walking the prototype chain and resolving constructors, which is necessary for robust identification of cross-realm instances. For more robust validation, see [`@stdlib/assert/is-complex128array`][@stdlib/assert/is-complex128array]. |
| 60 | + |
| 61 | +</section> |
| 62 | + |
| 63 | +<!-- /.notes --> |
| 64 | + |
| 65 | +<section class="examples"> |
| 66 | + |
| 67 | +## Examples |
| 68 | + |
| 69 | +<!-- eslint-disable object-curly-newline --> |
| 70 | + |
| 71 | +<!-- eslint no-undef: "error" --> |
| 72 | + |
| 73 | +```javascript |
| 74 | +var Int8Array = require( '@stdlib/array/int8' ); |
| 75 | +var Uint8Array = require( '@stdlib/array/uint8' ); |
| 76 | +var Uint8ClampedArray = require( '@stdlib/array/uint8c' ); |
| 77 | +var Int16Array = require( '@stdlib/array/int16' ); |
| 78 | +var Uint16Array = require( '@stdlib/array/uint16' ); |
| 79 | +var Int32Array = require( '@stdlib/array/int32' ); |
| 80 | +var Uint32Array = require( '@stdlib/array/uint32' ); |
| 81 | +var Float32Array = require( '@stdlib/array/float32' ); |
| 82 | +var Float64Array = require( '@stdlib/array/float64' ); |
| 83 | +var Complex128Array = require( '@stdlib/array/complex128' ); |
| 84 | +var Complex64Array = require( '@stdlib/array/complex64' ); |
| 85 | +var isComplex128Array = require( '@stdlib/array/base/assert/is-complex128array' ); |
| 86 | + |
| 87 | +var bool = isComplex128Array( new Complex128Array( 10 ) ); |
| 88 | +// returns true |
| 89 | + |
| 90 | +bool = isComplex128Array( new Complex64Array( 10 ) ); |
| 91 | +// returns false |
| 92 | + |
| 93 | +bool = isComplex128Array( [] ); |
| 94 | +// returns false |
| 95 | + |
| 96 | +bool = isComplex128Array( new Float64Array( 10 ) ); |
| 97 | +// returns false |
| 98 | + |
| 99 | +bool = isComplex128Array( new Float32Array( 10 ) ); |
| 100 | +// returns false |
| 101 | + |
| 102 | +bool = isComplex128Array( new Int32Array( 10 ) ); |
| 103 | +// returns false |
| 104 | + |
| 105 | +bool = isComplex128Array( new Uint32Array( 10 ) ); |
| 106 | +// returns false |
| 107 | + |
| 108 | +bool = isComplex128Array( new Int16Array( 10 ) ); |
| 109 | +// returns false |
| 110 | + |
| 111 | +bool = isComplex128Array( new Uint16Array( 10 ) ); |
| 112 | +// returns false |
| 113 | + |
| 114 | +bool = isComplex128Array( new Int8Array( 10 ) ); |
| 115 | +// returns false |
| 116 | + |
| 117 | +bool = isComplex128Array( new Uint8Array( 10 ) ); |
| 118 | +// returns false |
| 119 | + |
| 120 | +bool = isComplex128Array( new Uint8ClampedArray( 10 ) ); |
| 121 | +// returns false |
| 122 | + |
| 123 | +bool = isComplex128Array( { 'length': 0 } ); |
| 124 | +// returns false |
| 125 | +``` |
| 126 | + |
| 127 | +</section> |
| 128 | + |
| 129 | +<!-- /.examples --> |
| 130 | + |
| 131 | +<!-- Section for related `stdlib` packages. Do not manually edit this section, as it is automatically populated. --> |
| 132 | + |
| 133 | +<section class="related"> |
| 134 | + |
| 135 | +</section> |
| 136 | + |
| 137 | +<!-- /.related --> |
| 138 | + |
| 139 | +<!-- Section for all links. Make sure to keep an empty line after the `section` element and another before the `/section` close. --> |
| 140 | + |
| 141 | +<section class="links"> |
| 142 | + |
| 143 | +[@stdlib/array/complex128]: https://github.com/stdlib-js/array/tree/main/complex128 |
| 144 | + |
| 145 | +[@stdlib/assert/is-complex128array]: https://github.com/stdlib-js/stdlib |
| 146 | + |
| 147 | +<!-- <related-links> --> |
| 148 | + |
| 149 | +<!-- </related-links> --> |
| 150 | + |
| 151 | +</section> |
| 152 | + |
| 153 | +<!-- /.links --> |
0 commit comments