Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions lib/node_modules/@stdlib/array/to-fancy/docs/types/index.d.ts
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
* @param id - identifier
* @returns index data
*/
get( id: any ): IndexArrayObject | null;

Check warning on line 36 in lib/node_modules/@stdlib/array/to-fancy/docs/types/index.d.ts

View workflow job for this annotation

GitHub Actions / Lint Changed Files

Unexpected any. Specify a different type
}

/**
Expand Down Expand Up @@ -87,6 +87,17 @@
* // returns <Float32Array>[ 1.0, 2.0, 3.0, 4.0 ]
*
* @example
* var Float16Array = require( '@stdlib/array/float16' );
*
* var x = new Float16Array( [ 1.0, 2.0, 3.0, 4.0 ] );
*
* var y = array2fancy( x );
* // returns <Float16Array>
*
* var v = y[ ':' ];
* // returns <Float16Array>[ 1.0, 2.0, 3.0, 4.0 ]
*
* @example
* var Complex128Array = require( '@stdlib/array/complex128' );
*
* var x = new Complex128Array( [ 1.0, 2.0, 3.0, 4.0 ] );
Expand Down
3 changes: 3 additions & 0 deletions lib/node_modules/@stdlib/array/to-fancy/docs/types/test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
* limitations under the License.
*/

import Float16Array = require( '@stdlib/array/float16' );
import Complex128Array = require( '@stdlib/array/complex128' );
import Complex64Array = require( '@stdlib/array/complex64' );
import BooleanArray = require( '@stdlib/array/bool' );
Expand All @@ -29,6 +30,7 @@ import array2fancy = require( './index' );
array2fancy( [ 1, 2, 3 ] ); // $ExpectType number[]
array2fancy( new Float64Array( [ 1, 2, 3 ] ) ); // $ExpectType Float64Array
array2fancy( new Float32Array( [ 1, 2, 3 ] ) ); // $ExpectType Float32Array
array2fancy( new Float16Array( [ 1, 2, 3 ] ) ); // $ExpectType Float16Array
array2fancy( new Int32Array( [ 1, 2, 3 ] ) ); // $ExpectType Int32Array
array2fancy( new Int16Array( [ 1, 2, 3 ] ) ); // $ExpectType Int16Array
array2fancy( new Int8Array( [ 1, 2, 3 ] ) ); // $ExpectType Int8Array
Expand All @@ -46,6 +48,7 @@ import array2fancy = require( './index' );
array2fancy( [ 1, 2, 3 ], opts ); // $ExpectType number[]
array2fancy( new Float64Array( [ 1, 2, 3 ] ), opts ); // $ExpectType Float64Array
array2fancy( new Float32Array( [ 1, 2, 3 ] ), opts ); // $ExpectType Float32Array
array2fancy( new Float16Array( [ 1, 2, 3 ] ), opts ); // $ExpectType Float16Array
array2fancy( new Int32Array( [ 1, 2, 3 ] ), opts ); // $ExpectType Int32Array
array2fancy( new Int16Array( [ 1, 2, 3 ] ), opts ); // $ExpectType Int16Array
array2fancy( new Int8Array( [ 1, 2, 3 ] ), opts ); // $ExpectType Int8Array
Expand Down
137 changes: 137 additions & 0 deletions lib/node_modules/@stdlib/array/to-fancy/test/test.set.boolean_array.js
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,11 @@
var hasProxySupport = require( '@stdlib/assert/has-proxy-support' );
var isSameComplex128Array = require( '@stdlib/assert/is-same-complex128array' );
var isSameComplex64Array = require( '@stdlib/assert/is-same-complex64array' );
var isSameFloat16Array = require( '@stdlib/assert/is-same-float16array' );
var Complex128 = require( '@stdlib/complex/float64/ctor' );
var Float64Array = require( '@stdlib/array/float64' );
var Float32Array = require( '@stdlib/array/float32' );
var Float16Array = require( '@stdlib/array/float16' );
var Int32Array = require( '@stdlib/array/int32' );
var Int8Array = require( '@stdlib/array/int8' );
var Uint32Array = require( '@stdlib/array/uint32' );
Expand Down Expand Up @@ -278,6 +280,51 @@
t.end();
});

tape( 'the function returns an array-like object supporting boolean array assignment (float16)', opts, function test( t ) {
var expected;
var idx;
var x;
var y;

x = new Float16Array( [ 1, 2, 3, 4 ] );
y = array2fancy( x );

idx = array2fancy.idx( [ true, true, true, true ] );
expected = new Float16Array( [ 5, 6, 7, 8 ] );
y[ idx ] = new Float16Array( [ 5, 6, 7, 8 ] );

t.strictEqual( isSameFloat16Array( y, expected ), true, 'returns expected value' );

x = new Float16Array( [ 1, 2, 3, 4 ] );
y = array2fancy( x );

idx = array2fancy.idx( new BooleanArray( [ true, true, false, false ] ) );
expected = new Float16Array( [ 5, 6, 3, 4 ] );
y[ idx ] = new Float16Array( [ 5, 6 ] );

t.strictEqual( isSameFloat16Array( y, expected ), true, 'returns expected value' );

x = new Float16Array( [ 1, 2, 3, 4 ] );
y = array2fancy( x );

idx = array2fancy.idx( [ false, true, true, false ] );
expected = new Float16Array( [ 1, 5, 6, 4 ] );
y[ idx ] = new Float16Array( [ 5, 6 ] );

t.strictEqual( isSameFloat16Array( y, expected ), true, 'returns expected value' );

x = new Float16Array( [ 1, 2, 3, 4 ] );
y = array2fancy( x );

idx = array2fancy.idx( new BooleanArray( [ true, false, true, false ] ) );
expected = new Float16Array( [ 5, 2, 6, 4 ] );
y[ idx ] = new Float16Array( [ 5, 6 ] );

t.strictEqual( isSameFloat16Array( y, expected ), true, 'returns expected value' );

t.end();
});

tape( 'the function returns an array-like object supporting boolean array assignment (complex128)', opts, function test( t ) {
var expected;
var idx;
Expand Down Expand Up @@ -917,6 +964,51 @@
t.end();
});

tape( 'the function returns an array-like object supporting casting (float64, float16)', opts, function test( t ) {
var expected;
var idx;
var x;
var y;

x = new Float64Array( [ 1, 2, 3, 4 ] );
y = array2fancy( x );

idx = array2fancy.idx( [ true, true, true, true ] );
expected = new Float64Array( [ 5, 6, 7, 8 ] );
y[ idx ] = new Float16Array( [ 5, 6, 7, 8 ] );

t.deepEqual( y, expected, 'returns expected value' );

x = new Float64Array( [ 1, 2, 3, 4 ] );
y = array2fancy( x );

idx = array2fancy.idx( new BooleanArray( [ true, true, false, false ] ) );
expected = new Float64Array( [ 5, 6, 3, 4 ] );
y[ idx ] = new Float16Array( [ 5, 6 ] );

t.deepEqual( y, expected, 'returns expected value' );

x = new Float64Array( [ 1, 2, 3, 4 ] );
y = array2fancy( x );

idx = array2fancy.idx( [ false, true, true, false ] );
expected = new Float64Array( [ 1, 5, 6, 4 ] );
y[ idx ] = new Float16Array( [ 5, 6 ] );

t.deepEqual( y, expected, 'returns expected value' );

x = new Float64Array( [ 1, 2, 3, 4 ] );
y = array2fancy( x );

idx = array2fancy.idx( new BooleanArray( [ true, false, true, false ] ) );
expected = new Float64Array( [ 5, 2, 6, 4 ] );
y[ idx ] = new Float16Array( [ 5, 6 ] );

t.deepEqual( y, expected, 'returns expected value' );

t.end();
});

tape( 'the function returns an array-like object supporting casting (int32, int8)', opts, function test( t ) {
var expected;
var idx;
Expand Down Expand Up @@ -1142,6 +1234,51 @@
t.end();
});

tape( 'the function returns an array-like object supporting downcasting of floating-point arrays (float16, float64)', opts, function test( t ) {
var expected;
var idx;
var x;
var y;

x = new Float16Array( [ 1, 2, 3, 4 ] );
y = array2fancy( x );

idx = array2fancy.idx( [ true, true, true, true ] );
expected = new Float16Array( [ 5, 6, 7, 8 ] );
y[ idx ] = new Float64Array( [ 5, 6, 7, 8 ] );

t.strictEqual( isSameFloat16Array( y, expected ), true, 'returns expected value' );

x = new Float16Array( [ 1, 2, 3, 4 ] );
y = array2fancy( x );

idx = array2fancy.idx( new BooleanArray( [ true, true, false, false ] ) );
expected = new Float16Array( [ 5, 6, 3, 4 ] );
y[ idx ] = new Float64Array( [ 5, 6 ] );

t.strictEqual( isSameFloat16Array( y, expected ), true, 'returns expected value' );

x = new Float16Array( [ 1, 2, 3, 4 ] );
y = array2fancy( x );

idx = array2fancy.idx( [ false, true, true, false ] );
expected = new Float16Array( [ 1, 5, 6, 4 ] );
y[ idx ] = new Float64Array( [ 5, 6 ] );

t.strictEqual( isSameFloat16Array( y, expected ), true, 'returns expected value' );

x = new Float16Array( [ 1, 2, 3, 4 ] );
y = array2fancy( x );

idx = array2fancy.idx( new BooleanArray( [ true, false, true, false ] ) );
expected = new Float16Array( [ 5, 2, 6, 4 ] );
y[ idx ] = new Float64Array( [ 5, 6 ] );

t.strictEqual( isSameFloat16Array( y, expected ), true, 'returns expected value' );

t.end();
});

tape( 'the function returns an array-like object supporting downcasting of floating-point arrays (complex64, complex128)', opts, function test( t ) {
var expected;
var idx;
Expand Down Expand Up @@ -1306,7 +1443,7 @@
values = [
'5',
true,
false

Check warning on line 1446 in lib/node_modules/@stdlib/array/to-fancy/test/test.set.boolean_array.js

View workflow job for this annotation

GitHub Actions / Lint Changed Files

File has too many lines (1206). Maximum allowed is 1000
];
for ( i = 0; i < values.length; i++ ) {
t.throws( badValue( values[ i ] ), TypeError, 'throws an error when provided ' + values[ i ] );
Expand Down
Loading