|
| 1 | +/* |
| 2 | +* @license Apache-2.0 |
| 3 | +* |
| 4 | +* Copyright (c) 2024 The Stdlib Authors. |
| 5 | +* |
| 6 | +* Licensed under the Apache License, Version 2.0 (the "License"); |
| 7 | +* you may not use this file except in compliance with the License. |
| 8 | +* You may obtain a copy of the License at |
| 9 | +* |
| 10 | +* http://www.apache.org/licenses/LICENSE-2.0 |
| 11 | +* |
| 12 | +* Unless required by applicable law or agreed to in writing, software |
| 13 | +* distributed under the License is distributed on an "AS IS" BASIS, |
| 14 | +* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. |
| 15 | +* See the License for the specific language governing permissions and |
| 16 | +* limitations under the License. |
| 17 | +*/ |
| 18 | + |
| 19 | +import toAccessorArray = require( '@stdlib/array/base/to-accessor-array' ); |
| 20 | +import every = require( './index' ); |
| 21 | + |
| 22 | + |
| 23 | +// TESTS // |
| 24 | + |
| 25 | +// The function returns a boolean... |
| 26 | +{ |
| 27 | + every( [ 1, 2, 3 ] ); // $ExpectType boolean |
| 28 | + every( new Float64Array( [ 1, 2, 3 ] ) ); // $ExpectType boolean |
| 29 | + every( new Float32Array( [ 1, 2, 3 ] ) ); // $ExpectType boolean |
| 30 | + every( new Int32Array( [ 1, 2, 3 ] ) ); // $ExpectType boolean |
| 31 | + every( new Int16Array( [ 1, 2, 3 ] ) ); // $ExpectType boolean |
| 32 | + every( new Int8Array( [ 1, 2, 3 ] ) ); // $ExpectType boolean |
| 33 | + every( new Uint32Array( [ 1, 2, 3 ] ) ); // $ExpectType boolean |
| 34 | + every( new Uint16Array( [ 1, 2, 3 ] ) ); // $ExpectType boolean |
| 35 | + every( new Uint8Array( [ 1, 2, 3 ] ) ); // $ExpectType boolean |
| 36 | + every( new Uint8ClampedArray( [ 1, 2, 3 ] ) ); // $ExpectType boolean |
| 37 | + every( toAccessorArray( [ 1, 2, 3 ] ) ); // $ExpectType boolean |
| 38 | +} |
| 39 | + |
| 40 | +// The compiler throws an error if the function is provided a first argument which is not a collection... |
| 41 | +{ |
| 42 | + every( 2 ); // $ExpectError |
| 43 | + every( false ); // $ExpectError |
| 44 | + every( true ); // $ExpectError |
| 45 | + every( {} ); // $ExpectError |
| 46 | +} |
| 47 | + |
| 48 | +// The compiler throws an error if the function is provided an unsupported number of arguments... |
| 49 | +{ |
| 50 | + every(); // $ExpectError |
| 51 | + every( [ 1, 2, 3 ], {}, 3 ); // $ExpectError |
| 52 | +} |
0 commit comments