Skip to content

Commit

Permalink
Auto-generated commit
Browse files Browse the repository at this point in the history
  • Loading branch information
stdlib-bot committed Feb 20, 2024
1 parent 593032a commit 26d4f6d
Show file tree
Hide file tree
Showing 16 changed files with 1,013 additions and 86 deletions.
12 changes: 6 additions & 6 deletions convert-same/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.
-->

# Convert
# convertSame

> Convert an array to the same data type as a second input array.
Expand All @@ -37,10 +37,10 @@ limitations under the License.
## Usage

```javascript
var convertArraySame = require( '@stdlib/array/convert-same' );
var convertSame = require( '@stdlib/array/convert-same' );
```

#### convertArraySame( x, y )
#### convertSame( x, y )

Converts an array to the same data type as a second input array.

Expand All @@ -50,7 +50,7 @@ var Float32Array = require( '@stdlib/array/float32' );
var x = [ 1.0, 2.0, 3.0 ];
var y = new Float32Array( 0 );

var out = convertArraySame( x, y );
var out = convertSame( x, y );
// returns <Float32Array>[ 1.0, 2.0, 3.0 ]
```

Expand Down Expand Up @@ -96,7 +96,7 @@ var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
var filledarrayBy = require( '@stdlib/array/filled-by' );
var dtypes = require( '@stdlib/array/dtypes' );
var ctors = require( '@stdlib/array/ctors' );
var convertArraySame = require( '@stdlib/array/convert-same' );
var convertSame = require( '@stdlib/array/convert-same' );

// Create a generic array:
var arr = filledarrayBy( 5, 'generic', discreteUniform( -100, 100 ) );
Expand All @@ -108,7 +108,7 @@ var DTYPES = dtypes();
var out;
var i;
for ( i = 0; i < DTYPES.length; i++ ) {
out = convertArraySame( arr, new ( ctors( DTYPES[ i ] ) )( 0 ) );
out = convertSame( arr, new ( ctors( DTYPES[ i ] ) )( 0 ) );
console.log( out );
}
```
Expand Down
4 changes: 2 additions & 2 deletions convert-same/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
var filledarrayBy = require( './../../filled-by' );
var dtypes = require( './../../dtypes' );
var ctors = require( './../../ctors' );
var convertArraySame = require( './../lib' );
var convertSame = require( './../lib' );

// Create a generic array:
var arr = filledarrayBy( 5, 'generic', discreteUniform( -100, 100 ) );
Expand All @@ -34,6 +34,6 @@ var DTYPES = dtypes();
var out;
var i;
for ( i = 0; i < DTYPES.length; i++ ) {
out = convertArraySame( arr, new ( ctors( DTYPES[ i ] ) )( 0 ) );
out = convertSame( arr, new ( ctors( DTYPES[ i ] ) )( 0 ) );
console.log( out );
}
12 changes: 6 additions & 6 deletions convert/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ limitations under the License.
-->

# Convert
# convert

> Convert an array to an array of a different data type.
Expand All @@ -37,16 +37,16 @@ limitations under the License.
## Usage

```javascript
var convertArray = require( '@stdlib/array/convert' );
var convert = require( '@stdlib/array/convert' );
```

#### convertArray( arr, dtype )
#### convert( arr, dtype )

Converts an array to an array of a different data type.

```javascript
var arr = [ 1.0, 2.0, 3.0 ];
var out = convertArray( arr, 'float32' );
var out = convert( arr, 'float32' );
// returns <Float32Array>[ 1.0, 2.0, 3.0 ]
```

Expand Down Expand Up @@ -89,7 +89,7 @@ The function supports the following data types:
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
var filledarrayBy = require( '@stdlib/array/filled-by' );
var dtypes = require( '@stdlib/array/dtypes' );
var convertArray = require( '@stdlib/array/convert' );
var convert = require( '@stdlib/array/convert' );

// Create a generic array:
var arr = filledarrayBy( 5, 'generic', discreteUniform( -100, 100 ) );
Expand All @@ -101,7 +101,7 @@ var DTYPES = dtypes();
var out;
var i;
for ( i = 0; i < DTYPES.length; i++ ) {
out = convertArray( arr, DTYPES[ i ] );
out = convert( arr, DTYPES[ i ] );
console.log( out );
}
```
Expand Down
4 changes: 2 additions & 2 deletions convert/examples/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
var discreteUniform = require( '@stdlib/random/base/discrete-uniform' ).factory;
var filledarrayBy = require( './../../filled-by' );
var dtypes = require( './../../dtypes' );
var convertArray = require( './../lib' );
var convert = require( './../lib' );

// Create a generic array:
var arr = filledarrayBy( 5, 'generic', discreteUniform( -100, 100 ) );
Expand All @@ -33,6 +33,6 @@ var DTYPES = dtypes();
var out;
var i;
for ( i = 0; i < DTYPES.length; i++ ) {
out = convertArray( arr, DTYPES[ i ] );
out = convert( arr, DTYPES[ i ] );
console.log( out );
}
Loading

0 comments on commit 26d4f6d

Please sign in to comment.