Callback function.
Nullary callback function.
Unary callback function.
Creates a filled array according to a provided callback function and having a specified data type.
The function recognizes the following data types:
float64
: double-precision floating-point numbers (IEEE 754)float32
: single-precision floating-point numbers (IEEE 754)complex128
: double-precision complex floating-point numberscomplex64
: single-precision complex floating-point numbersint32
: 32-bit two's complement signed integersuint32
: 32-bit unsigned integersint16
: 16-bit two's complement signed integersuint16
: 16-bit unsigned integersint8
: 8-bit two's complement signed integersuint8
: 8-bit unsigned integersuint8c
: 8-bit unsigned integers clamped to 0-255
generic
: generic JavaScript valuesdata type
filled array
var arr = filledarrayBy();
// returns <Float64Array>
var arr = filledarrayBy( 'float32' );
// returns <Float32Array>
Creates a filled array according to a provided callback function and having a specified length
.
array length
callback function
callback function execution context
filled array
var constantFunction = require( `@stdlib/utils/constant-function` );
var arr = filledarrayBy( 5, constantFunction( 1.0 ) );
// returns <Float64Array>[ 1.0, 1.0, 1.0, 1.0, 1.0 ]
Creates a filled array according to a provided callback function and having a specified length
.
The function recognizes the following data types:
float64
: double-precision floating-point numbers (IEEE 754)float32
: single-precision floating-point numbers (IEEE 754)complex128
: double-precision complex floating-point numberscomplex64
: single-precision complex floating-point numbersint32
: 32-bit two's complement signed integersuint32
: 32-bit unsigned integersint16
: 16-bit two's complement signed integersuint16
: 16-bit unsigned integersint8
: 8-bit two's complement signed integersuint8
: 8-bit unsigned integersuint8c
: 8-bit unsigned integers clamped to 0-255
generic
: generic JavaScript valuesarray length
data type
callback function
callback function execution context
filled array
var constantFunction = require( `@stdlib/utils/constant-function` );
var arr = filledarrayBy( 5, 'float64', constantFunction( 1.0 ) );
// returns <Float64Array>[ 1.0, 1.0, 1.0, 1.0, 1.0 ]
Creates a filled array from another array
according to a provided callback function.
typed array or array-like object
callback function
callback function execution context
filled array
var constantFunction = require( `@stdlib/utils/constant-function` );
var arr = filledarrayBy( [ 5.0, -3.0, 2.0 ], constantFunction( 1.0 ) );
// returns <Float64Array>[ 1.0, 1.0, 1.0 ]
Creates a filled array from another array
according to a provided callback function.
The function recognizes the following data types:
float64
: double-precision floating-point numbers (IEEE 754)float32
: single-precision floating-point numbers (IEEE 754)complex128
: double-precision complex floating-point numberscomplex64
: single-precision complex floating-point numbersint32
: 32-bit two's complement signed integersuint32
: 32-bit unsigned integersint16
: 16-bit two's complement signed integersuint16
: 16-bit unsigned integersint8
: 8-bit two's complement signed integersuint8
: 8-bit unsigned integersuint8c
: 8-bit unsigned integers clamped to 0-255
generic
: generic JavaScript valuestyped array or array-like object
data type
callback function
callback function execution context
filled array
var constantFunction = require( `@stdlib/utils/constant-function` );
var arr = filledarrayBy( [ 5.0, -3.0, 2.0 ], 'float64', constantFunction( 1.0 ) );
// returns <Float64Array>[ 1.0, 1.0, 1.0 ]
Creates a filled array from an iterable according to a callback function.
iterable
callback function execution context
filled array
var constantFunction = require( `@stdlib/utils/constant-function` );
var iterConstant = require( `@stdlib/iter/constant` );
var it = iterConstant( 3.0, {
'iter': 3
});
var arr = filledarrayBy( it, constantFunction( 1.0 ) );
// returns <Float64Array>[ 1.0, 1.0, 1.0 ]
Creates a filled array from an iterable according to a callback function.
The function recognizes the following data types:
float64
: double-precision floating-point numbers (IEEE 754)float32
: single-precision floating-point numbers (IEEE 754)complex128
: double-precision complex floating-point numberscomplex64
: single-precision complex floating-point numbersint32
: 32-bit two's complement signed integersuint32
: 32-bit unsigned integersint16
: 16-bit two's complement signed integersuint16
: 16-bit unsigned integersint8
: 8-bit two's complement signed integersuint8
: 8-bit unsigned integersuint8c
: 8-bit unsigned integers clamped to 0-255
generic
: generic JavaScript valuesiterable
data type
callback function execution context
filled array
var constantFunction = require( `@stdlib/utils/constant-function` );
var iterConstant = require( `@stdlib/iter/constant` );
var it = iterConstant( 3.0, {
'iter': 3
});
var arr = filledarrayBy( it, 'float64', constantFunction( 1.0 ) );
// returns <Float64Array>[ 1.0, 1.0, 1.0 ]
Returns a filled typed array view of an ArrayBuffer
according to a provided callback function.
ArrayBuffer
is not supported.ArrayBuffer
byte offset
view length
callback function
callback function execution context
filled array
var constantFunction = require( `@stdlib/utils/constant-function` );
var ArrayBuffer = require( `@stdlib/array/buffer` );
var buf = new ArrayBuffer( 32 );
var arr = filledarrayBy( buf, 8, 2, constantFunction( 1.0 ) );
// returns <Float64Array>[ 1.0, 1.0 ]
Returns a filled typed array view of an ArrayBuffer
according to a provided callback function.
The function recognizes the following data types:
float64
: double-precision floating-point numbers (IEEE 754)float32
: single-precision floating-point numbers (IEEE 754)complex128
: double-precision complex floating-point numberscomplex64
: single-precision complex floating-point numbersint32
: 32-bit two's complement signed integersuint32
: 32-bit unsigned integersint16
: 16-bit two's complement signed integersuint16
: 16-bit unsigned integersint8
: 8-bit two's complement signed integersuint8
: 8-bit unsigned integersuint8c
: 8-bit unsigned integers clamped to 0-255
generic
: generic JavaScript valuesArrayBuffer
is not supported.ArrayBuffer
byte offset
view length
data type
callback function
callback function execution context
filled array
var constantFunction = require( `@stdlib/utils/constant-function` );
var ArrayBuffer = require( `@stdlib/array/buffer` );
var buf = new ArrayBuffer( 32 );
var arr = filledarrayBy( buf, 8, 2, 'float64', constantFunction( 1.0 ) );
// returns <Float64Array>[ 1.0, 1.0 ]
Returns a filled typed array view of an ArrayBuffer
according to a provided callback function.
ArrayBuffer
is not supported.ArrayBuffer
byte offset
callback function
callback function execution context
filled array
var constantFunction = require( `@stdlib/utils/constant-function` );
var ArrayBuffer = require( `@stdlib/array/buffer` );
var buf = new ArrayBuffer( 32 );
var arr = filledarrayBy( buf, 8, constantFunction( 1.0 ) );
// returns <Float64Array>[ 1.0, 1.0, 1.0 ]
Returns a filled typed array view of an ArrayBuffer
according to a provided callback function.
The function recognizes the following data types:
float64
: double-precision floating-point numbers (IEEE 754)float32
: single-precision floating-point numbers (IEEE 754)complex128
: double-precision complex floating-point numberscomplex64
: single-precision complex floating-point numbersint32
: 32-bit two's complement signed integersuint32
: 32-bit unsigned integersint16
: 16-bit two's complement signed integersuint16
: 16-bit unsigned integersint8
: 8-bit two's complement signed integersuint8
: 8-bit unsigned integersuint8c
: 8-bit unsigned integers clamped to 0-255
generic
: generic JavaScript valuesArrayBuffer
is not supported.ArrayBuffer
byte offset
data type
callback function
callback function execution context
filled array
var constantFunction = require( `@stdlib/utils/constant-function` );
var ArrayBuffer = require( `@stdlib/array/buffer` );
var buf = new ArrayBuffer( 32 );
var arr = filledarrayBy( buf, 8, 'float64', constantFunction( 1.0 ) );
// returns <Float64Array>[ 1.0, 1.0, 1.0 ]
Returns a filled typed array view of an ArrayBuffer
according to a provided callback function.
ArrayBuffer
is not supported.ArrayBuffer
callback function
callback function execution context
filled array
var constantFunction = require( `@stdlib/utils/constant-function` );
var ArrayBuffer = require( `@stdlib/array/buffer` );
var buf = new ArrayBuffer( 32 );
var arr = filledarrayBy( buf, constantFunction( 1.0 ) );
// returns <Float64Array>[ 1.0, 1.0, 1.0, 1.0 ]
Returns a filled typed array view of an ArrayBuffer
according to a provided callback function.
The function recognizes the following data types:
float64
: double-precision floating-point numbers (IEEE 754)float32
: single-precision floating-point numbers (IEEE 754)complex128
: double-precision complex floating-point numberscomplex64
: single-precision complex floating-point numbersint32
: 32-bit two's complement signed integersuint32
: 32-bit unsigned integersint16
: 16-bit two's complement signed integersuint16
: 16-bit unsigned integersint8
: 8-bit two's complement signed integersuint8
: 8-bit unsigned integersuint8c
: 8-bit unsigned integers clamped to 0-255
generic
: generic JavaScript valuesArrayBuffer
is not supported.ArrayBuffer
data type
callback function
callback function execution context
filled array
var constantFunction = require( `@stdlib/utils/constant-function` );
var ArrayBuffer = require( `@stdlib/array/buffer` );
var buf = new ArrayBuffer( 32 );
var arr = filledarrayBy( buf, 'float64', constantFunction( 1.0 ) );
// returns <Float64Array>[ 1.0, 1.0, 1.0, 1.0 ]
Array or typed array.