diff --git a/README.md b/README.md
index 90b8606..e27fcdb 100644
--- a/README.md
+++ b/README.md
@@ -2,7 +2,7 @@
@license Apache-2.0
-Copyright (c) 2020 The Stdlib Authors.
+Copyright (c) 2024 The Stdlib Authors.
Licensed under the Apache License, Version 2.0 (the "License");
you may not use this file except in compliance with the License.
@@ -29,7 +29,7 @@ limitations under the License.
To join us in bringing numerical computing to the web, get started by checking us out on GitHub, and please consider financially supporting stdlib. We greatly appreciate your continued support!
-# Filled Array
+# filledarray
[![NPM version][npm-image]][npm-url] [![Build Status][test-image]][test-url] [![Coverage Status][coverage-image]][coverage-url]
@@ -75,29 +75,14 @@ var filledarray = require( '@stdlib/array-filled' );
#### filledarray( \[dtype] )
-Creates a filled array having a specified data type `dtype`.
+Creates a filled array having a specified [data type][@stdlib/array/dtypes] `dtype`.
```javascript
var arr = filledarray();
// returns
```
-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 numbers
-- `complex64`: single-precision complex floating-point numbers
-- `int32`: 32-bit two's complement signed integers
-- `uint32`: 32-bit unsigned integers
-- `int16`: 16-bit two's complement signed integers
-- `uint16`: 16-bit unsigned integers
-- `int8`: 8-bit two's complement signed integers
-- `uint8`: 8-bit unsigned integers
-- `uint8c`: 8-bit unsigned integers clamped to `0-255`
-- `generic`: generic JavaScript values
-
-By default, the output array data type is `float64` (i.e., a [typed array][mdn-typed-array]). To specify an alternative data type, provide a `dtype` argument.
+By default, the output array [data type][@stdlib/array/dtypes] is `float64` (i.e., a [typed array][mdn-typed-array]). To specify an alternative [data type][@stdlib/array/dtypes], provide a `dtype` argument.
```javascript
var arr = filledarray( 'int32' );
@@ -336,6 +321,8 @@ Copyright © 2016-2024. The Stdlib [Authors][stdlib-authors].
[mdn-arraybuffer]: https://developer.mozilla.org/en-US/docs/Web/JavaScript/Reference/Global_Objects/ArrayBuffer
+[@stdlib/array/dtypes]: https://github.com/stdlib-js/array-dtypes
+
[@stdlib/array/filled-by]: https://github.com/stdlib-js/array-filled-by
diff --git a/benchmark/benchmark.js b/benchmark/benchmark.js
index f596671..2d298f6 100644
--- a/benchmark/benchmark.js
+++ b/benchmark/benchmark.js
@@ -85,6 +85,24 @@ bench( pkg+':dtype=float32', function benchmark( b ) {
b.end();
});
+bench( pkg+':dtype=bool', function benchmark( b ) {
+ var arr;
+ var i;
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ arr = filledarray( true, 0, 'bool' );
+ if ( arr.length !== 0 ) {
+ b.fail( 'should have length 0' );
+ }
+ }
+ b.toc();
+ if ( !isTypedArrayLike( arr ) ) {
+ b.fail( 'should return a typed array' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+});
+
bench( pkg+':dtype=complex128', function benchmark( b ) {
var arr;
var v;
diff --git a/benchmark/benchmark.length.bool.js b/benchmark/benchmark.length.bool.js
new file mode 100644
index 0000000..c9e4209
--- /dev/null
+++ b/benchmark/benchmark.length.bool.js
@@ -0,0 +1,93 @@
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2024 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
+
+'use strict';
+
+// MODULES //
+
+var bench = require( '@stdlib/bench-harness' );
+var pow = require( '@stdlib/math-base-special-pow' );
+var isTypedArrayLike = require( '@stdlib/assert-is-typed-array-like' );
+var pkg = require( './../package.json' ).name;
+var filledarray = require( './../lib' );
+
+
+// FUNCTIONS //
+
+/**
+* Creates a benchmark function.
+*
+* @private
+* @param {PositiveInteger} len - array length
+* @returns {Function} benchmark function
+*/
+function createBenchmark( len ) {
+ return benchmark;
+
+ /**
+ * Benchmark function.
+ *
+ * @private
+ * @param {Benchmark} b - benchmark instance
+ */
+ function benchmark( b ) {
+ var arr;
+ var i;
+
+ b.tic();
+ for ( i = 0; i < b.iterations; i++ ) {
+ arr = filledarray( true, len, 'bool' );
+ if ( arr.length !== len ) {
+ b.fail( 'unexpected length' );
+ }
+ }
+ b.toc();
+ if ( !isTypedArrayLike( arr ) ) {
+ b.fail( 'should return a typed array' );
+ }
+ b.pass( 'benchmark finished' );
+ b.end();
+ }
+}
+
+
+// MAIN //
+
+/**
+* Main execution sequence.
+*
+* @private
+*/
+function main() {
+ var len;
+ var min;
+ var max;
+ var f;
+ var i;
+
+ min = 1; // 10^min
+ max = 6; // 10^max
+
+ for ( i = min; i <= max; i++ ) {
+ len = pow( 10, i );
+ f = createBenchmark( len );
+ bench( pkg+':dtype=bool,len='+len, f );
+ }
+}
+
+main();
diff --git a/dist/index.js b/dist/index.js
index c17c35b..b8045f3 100644
--- a/dist/index.js
+++ b/dist/index.js
@@ -1,5 +1,19 @@
-"use strict";var w=function(i,e){return function(){return e||i((e={exports:{}}).exports,e),e.exports}};var m=w(function(B,d){
-var h=require('@stdlib/assert-is-string/dist').isPrimitive,g=require('@stdlib/assert-is-nonnegative-integer/dist').isPrimitive,f=require('@stdlib/assert-is-collection/dist'),v=require('@stdlib/assert-is-arraybuffer/dist'),y=require('@stdlib/assert-is-object/dist'),u=require('@stdlib/assert-is-function/dist'),c=require('@stdlib/array-ctors/dist'),b=require('@stdlib/blas-ext-base-gfill/dist'),E=require('@stdlib/array-base-filled/dist'),T=require('@stdlib/assert-has-iterator-symbol-support/dist'),s=require('@stdlib/symbol-iterator/dist'),q=require('@stdlib/iter-length/dist'),k=require('@stdlib/array-defaults/dist'),l=require('@stdlib/error-tools-fmtprodmsg/dist'),p=T(),M=k.get("dtypes.default");function j(i,e){var a,t;for(a=[];t=i.next(),!t.done;)a.push(e);return a}function V(i,e){var a;for(a=0;a=0&&h(arguments[e])?(a=arguments[e],e-=1):a=M,t=c(a),t===null)throw new TypeError(l('00j2Y',a));if(a==="generic"){if(e<=0)return[];if(i=arguments[0],r=arguments[1],e===1){if(g(r)?o=r:f(r)&&(o=r.length),o!==void 0)return E(i,o);if(v(r))throw new Error(l('00j04'));if(y(r)){if(p===!1)throw new TypeError(l('00j2Z',r));if(!u(r[s]))throw new TypeError(l('00j2a',r));if(r=r[s](),!u(r.next))throw new TypeError(l('00j2a',r));return j(r,i)}throw new TypeError(l('00j2a',r))}else if(v(r))throw new Error(l('00j04'));throw new TypeError(l('00j2a',r))}if(e<=0)return new t(0);if(e===1)if(r=arguments[1],f(r))n=new t(r.length);else if(v(r))n=new t(r);else if(g(r))n=new t(r);else if(y(r)){if(p===!1)throw new TypeError(l('00j2Z',r));if(!u(r[s]))throw new TypeError(l('00j2a',r));if(r=r[s](),!u(r.next))throw new TypeError(l('00j2a',r));n=new t(q(r))}else throw new TypeError(l('00j2a',r));else e===2?n=new t(arguments[1],arguments[2]):n=new t(arguments[1],arguments[2],arguments[3]);return n.length>0&&(/^complex/.test(a)?V(n,arguments[0]):b(n.length,arguments[0],n,1)),n}d.exports=A
-});var S=m();module.exports=S;
-/** @license Apache-2.0 */
+"use strict";var w=function(t,e){return function(){return e||t((e={exports:{}}).exports,e),e.exports}};var h=w(function(C,m){"use strict";var c=require("@stdlib/array-base-assert-is-complex-floating-point-data-type"),b=require("@stdlib/array-base-assert-is-boolean-data-type"),q=require("@stdlib/assert-is-string").isPrimitive,g=require("@stdlib/assert-is-nonnegative-integer").isPrimitive,y=require("@stdlib/assert-is-collection"),v=require("@stdlib/assert-is-arraybuffer"),f=require("@stdlib/assert-is-object"),u=require("@stdlib/assert-is-function"),E=require("@stdlib/array-ctors"),p=require("@stdlib/blas-ext-base-gfill"),T=require("@stdlib/array-base-filled"),k=require("@stdlib/strided-base-reinterpret-boolean"),M=require("@stdlib/assert-has-iterator-symbol-support"),s=require("@stdlib/symbol-iterator"),j=require("@stdlib/iter-length"),V=require("@stdlib/array-defaults"),l=require("@stdlib/string-format"),d=M(),A=V.get("dtypes.default");function S(t,e){var a,n;for(a=[];n=t.next(),!n.done;)a.push(e);return a}function B(t,e){var a;for(a=0;a=0&&q(arguments[e])?(a=arguments[e],e-=1):a=A,n=E(a),n===null)throw new TypeError(l("invalid argument. Must provide a recognized data type. Value: `%s`.",a));if(a==="generic"){if(e<=0)return[];if(t=arguments[0],r=arguments[1],e===1){if(g(r)?o=r:y(r)&&(o=r.length),o!==void 0)return T(t,o);if(v(r))throw new Error("invalid arguments. Creating a generic array from an ArrayBuffer is not supported.");if(f(r)){if(d===!1)throw new TypeError(l("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, typed array, or array-like object. Value: `%s`.",r));if(!u(r[s]))throw new TypeError(l("invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.",r));if(r=r[s](),!u(r.next))throw new TypeError(l("invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.",r));return S(r,t)}throw new TypeError(l("invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.",r))}else if(v(r))throw new Error("invalid arguments. Creating a generic array from an ArrayBuffer is not supported.");throw new TypeError(l("invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.",r))}if(e<=0)return new n(0);if(e===1)if(r=arguments[1],y(r))i=new n(r.length);else if(v(r))i=new n(r);else if(g(r))i=new n(r);else if(f(r)){if(d===!1)throw new TypeError(l("invalid argument. Environment lacks Symbol.iterator support. Must provide a length, typed array, or array-like object. Value: `%s`.",r));if(!u(r[s]))throw new TypeError(l("invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.",r));if(r=r[s](),!u(r.next))throw new TypeError(l("invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.",r));i=new n(j(r))}else throw new TypeError(l("invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.",r));else e===2?i=new n(arguments[1],arguments[2]):i=new n(arguments[1],arguments[2],arguments[3]);return i.length>0&&(t=arguments[0],c(a)?B(i,t):b(a)?p(i.length,t?1:0,k(i,0),1):p(i.length,t,i,1)),i}m.exports=x});var I=h();module.exports=I;
+/**
+* @license Apache-2.0
+*
+* Copyright (c) 2020 The Stdlib Authors.
+*
+* Licensed under the Apache License, Version 2.0 (the "License");
+* you may not use this file except in compliance with the License.
+* You may obtain a copy of the License at
+*
+* http://www.apache.org/licenses/LICENSE-2.0
+*
+* Unless required by applicable law or agreed to in writing, software
+* distributed under the License is distributed on an "AS IS" BASIS,
+* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
+* See the License for the specific language governing permissions and
+* limitations under the License.
+*/
//# sourceMappingURL=index.js.map
diff --git a/dist/index.js.map b/dist/index.js.map
index 08a4b31..79a5723 100644
--- a/dist/index.js.map
+++ b/dist/index.js.map
@@ -1,7 +1,7 @@
{
"version": 3,
"sources": ["../lib/main.js", "../lib/index.js"],
- "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' );\nvar isObject = require( '@stdlib/assert-is-object' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar ctors = require( '@stdlib/array-ctors' );\nvar gfill = require( '@stdlib/blas-ext-base-gfill' );\nvar filled = require( '@stdlib/array-base-filled' );\nvar hasIteratorSymbolSupport = require( '@stdlib/assert-has-iterator-symbol-support' );\nvar ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' );\nvar iterLength = require( '@stdlib/iter-length' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.default' );\n\n\n// FUNCTIONS //\n\n/**\n* Creates a filled \"generic\" array from an iterator.\n*\n* @private\n* @param {Iterator} it - iterator\n* @param {*} value - fill value\n* @returns {Array} filled array\n*/\nfunction filledIterator( it, value ) {\n\tvar arr;\n\tvar v;\n\n\tarr = [];\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\tarr.push( value );\n\t}\n\treturn arr;\n}\n\n/**\n* Fills an array exposing accessors for getting and setting array elements.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {*} value - fill value\n* @returns {Collection} input array\n*/\nfunction filledAccessors( arr, value ) {\n\tvar i;\n\tfor ( i = 0; i < arr.length; i++ ) {\n\t\tarr.set( value, i );\n\t}\n\treturn arr;\n}\n\n\n// MAIN //\n\n/**\n* Creates a filled array.\n*\n* @param {*} [value] - fill value\n* @param {(NonNegativeInteger|TypedArray|ArrayLikeObject|ArrayBuffer|Iterable)} [arg] - a length, typed array, array-like object, buffer, or iterable\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"float64\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @throws {TypeError} must provide a length, typed array, array-like object, buffer, or iterable\n* @throws {Error} creating a generic array from an `ArrayBuffer` is not supported\n* @returns {(TypedArray|Array|ComplexArray)} array or typed array\n*\n* @example\n* var arr = filledarray();\n* // returns \n*\n* @example\n* var arr = filledarray( 1.0, 2 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = filledarray( 1.0, 2, 'float32' );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = filledarray( 1.0, 2, 'generic' );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = filledarray( 1.0, [ 0.5, 0.5 ] );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = filledarray( 1, [ 5, -3 ], 'int32' );\n* // returns [ 1, 1 ]\n*\n* @example\n* var arr1 = filledarray( 2, [ 5, 3 ], 'int32' );\n* var arr2 = filledarray( 1.0, arr1 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr1 = filledarray( 2, [ 5, 3 ], 'int32' );\n* var arr2 = filledarray( 1, arr1, 'uint32' );\n* // returns [ 1, 1 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf, 'float32' );\n* // returns [ 1.0, 1.0, 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf, 8 );\n* // returns [ 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf, 8, 'float32' );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = filledarray( 1.0, buf, 8, 2 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = filledarray( 1, buf, 8, 2, 'int32' );\n* // returns [ 1, 1 ]\n*/\nfunction filledarray() {\n\tvar value;\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\tvar arr;\n\tvar len;\n\tvar arg;\n\n\tnargs = arguments.length;\n\tnargs -= 1;\n\tif ( nargs >= 0 && isString( arguments[ nargs ] ) ) {\n\t\tdtype = arguments[ nargs ];\n\t\tnargs -= 1;\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( dtype === 'generic' ) {\n\t\tif ( nargs <= 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tvalue = arguments[ 0 ];\n\t\targ = arguments[ 1 ];\n\t\tif ( nargs === 1 ) {\n\t\t\tif ( isNonNegativeInteger( arg ) ) {\n\t\t\t\tlen = arg;\n\t\t\t} else if ( isCollection( arg ) ) {\n\t\t\t\tlen = arg.length;\n\t\t\t}\n\t\t\tif ( len !== void 0 ) {\n\t\t\t\treturn filled( value, len );\n\t\t\t}\n\t\t\tif ( isArrayBuffer( arg ) ) {\n\t\t\t\tthrow new Error( 'invalid arguments. Creating a generic array from an ArrayBuffer is not supported.' );\n\t\t\t}\n\t\t\tif ( isObject( arg ) ) {\n\t\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, typed array, or array-like object. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\tif ( !isFunction( arg[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\targ = arg[ ITERATOR_SYMBOL ]();\n\t\t\t\tif ( !isFunction( arg.next ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\treturn filledIterator( arg, value );\n\t\t\t}\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t} else if ( isArrayBuffer( arg ) ) {\n\t\t\tthrow new Error( 'invalid arguments. Creating a generic array from an ArrayBuffer is not supported.' );\n\t\t}\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) { // length || array-like || ArrayBuffer || iterable\n\t\targ = arguments[ 1 ];\n\t\tif ( isCollection( arg ) ) {\n\t\t\tarr = new ctor( arg.length );\n\t\t} else if ( isArrayBuffer( arg ) ) {\n\t\t\tarr = new ctor( arg );\n\t\t} else if ( isNonNegativeInteger( arg ) ) {\n\t\t\tarr = new ctor( arg );\n\t\t} else if ( isObject( arg ) ) {\n\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, typed array, or array-like object. Value: `%s`.', arg ) );\n\t\t\t}\n\t\t\tif ( !isFunction( arg[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t}\n\t\t\targ = arg[ ITERATOR_SYMBOL ]();\n\t\t\tif ( !isFunction( arg.next ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t}\n\t\t\tarr = new ctor( iterLength( arg ) );\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t}\n\t} else if ( nargs === 2 ) {\n\t\tarr = new ctor( arguments[1], arguments[2] ); // (ArrayBuffer, byteOffset)\n\t} else {\n\t\tarr = new ctor( arguments[1], arguments[2], arguments[3] ); // (ArrayBuffer, byteOffset, length)\n\t}\n\tif ( arr.length > 0 ) {\n\t\tif ( /^complex/.test( dtype ) ) {\n\t\t\tfilledAccessors( arr, arguments[ 0 ] );\n\t\t} else {\n\t\t\tgfill( arr.length, arguments[ 0 ], arr, 1 );\n\t\t}\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = filledarray;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Create a filled array.\n*\n* @module @stdlib/array-filled\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr = filledarray();\n* // returns \n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr = filledarray( 1.0, 2 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr = filledarray( 1.0, 2, 'float32' );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr = filledarray( 1.0, 2, 'generic' );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr = filledarray( 1.0, [ 0.5, 0.5 ] );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr = filledarray( 1, [ 5, -3 ], 'int32' );\n* // returns [ 1, 1 ]\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr1 = filledarray( 10, [ 5, 3 ], 'int32' );\n* var arr2 = filledarray( 1.0, arr1 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr1 = filledarray( 1, [ 5, 3 ], 'int32' );\n* var arr2 = filledarray( 2, arr1, 'uint32' );\n* // returns [ 2, 2 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf, 'float32' );\n* // returns [ 1.0, 1.0, 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf, 8 );\n* // returns [ 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf, 8, 'float32' );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = filledarray( 1.0, buf, 8, 2 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = filledarray( 1, buf, 8, 2, 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,EAAI,CAC7B,GAAKd,IAAwB,GAC5B,MAAM,IAAI,UAAWD,EAAQ,sIAAuIe,CAAI,CAAE,EAE3K,GAAK,CAACvB,EAAYuB,EAAKlB,CAAgB,CAAE,EACxC,MAAM,IAAI,UAAWG,EAAQ,wGAAyGe,CAAI,CAAE,EAG7I,GADAA,EAAMA,EAAKlB,CAAgB,EAAE,EACxB,CAACL,EAAYuB,EAAI,IAAK,EAC1B,MAAM,IAAI,UAAWf,EAAQ,wGAAyGe,CAAI,CAAE,EAE7IT,EAAM,IAAIO,EAAMf,EAAYiB,CAAI,CAAE,CACnC,KACC,OAAM,IAAI,UAAWf,EAAQ,wGAAyGe,CAAI,CAAE,OAElIJ,IAAU,EACrBL,EAAM,IAAIO,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAE3CP,EAAM,IAAIO,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAE1D,OAAKP,EAAI,OAAS,IACZ,WAAW,KAAMM,CAAM,EAC3BJ,EAAiBF,EAAK,UAAW,CAAE,CAAE,EAErCZ,EAAOY,EAAI,OAAQ,UAAW,CAAE,EAAGA,EAAK,CAAE,GAGrCA,CACR,CAKApB,EAAO,QAAUwB,ICzJjB,IAAIM,EAAO,IAKX,OAAO,QAAUA",
- "names": ["require_main", "__commonJSMin", "exports", "module", "isString", "isNonNegativeInteger", "isCollection", "isArrayBuffer", "isObject", "isFunction", "ctors", "gfill", "filled", "hasIteratorSymbolSupport", "ITERATOR_SYMBOL", "iterLength", "defaults", "format", "HAS_ITERATOR_SYMBOL", "DEFAULT_DTYPE", "filledIterator", "it", "value", "arr", "v", "filledAccessors", "i", "filledarray", "nargs", "dtype", "ctor", "len", "arg", "main"]
+ "sourcesContent": ["/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n// MODULES //\n\nvar isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' );\nvar isBooleanDataType = require( '@stdlib/array-base-assert-is-boolean-data-type' );\nvar isString = require( '@stdlib/assert-is-string' ).isPrimitive;\nvar isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;\nvar isCollection = require( '@stdlib/assert-is-collection' );\nvar isArrayBuffer = require( '@stdlib/assert-is-arraybuffer' );\nvar isObject = require( '@stdlib/assert-is-object' );\nvar isFunction = require( '@stdlib/assert-is-function' );\nvar ctors = require( '@stdlib/array-ctors' );\nvar gfill = require( '@stdlib/blas-ext-base-gfill' );\nvar filled = require( '@stdlib/array-base-filled' );\nvar reinterpretBool = require( '@stdlib/strided-base-reinterpret-boolean' );\nvar hasIteratorSymbolSupport = require( '@stdlib/assert-has-iterator-symbol-support' );\nvar ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' );\nvar iterLength = require( '@stdlib/iter-length' );\nvar defaults = require( '@stdlib/array-defaults' );\nvar format = require( '@stdlib/string-format' );\n\n\n// VARIABLES //\n\nvar HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();\nvar DEFAULT_DTYPE = defaults.get( 'dtypes.default' );\n\n\n// FUNCTIONS //\n\n/**\n* Creates a filled \"generic\" array from an iterator.\n*\n* @private\n* @param {Iterator} it - iterator\n* @param {*} value - fill value\n* @returns {Array} filled array\n*/\nfunction filledIterator( it, value ) {\n\tvar arr;\n\tvar v;\n\n\tarr = [];\n\twhile ( true ) {\n\t\tv = it.next();\n\t\tif ( v.done ) {\n\t\t\tbreak;\n\t\t}\n\t\tarr.push( value );\n\t}\n\treturn arr;\n}\n\n/**\n* Fills an array exposing accessors for getting and setting array elements.\n*\n* @private\n* @param {Collection} arr - input array\n* @param {*} value - fill value\n* @returns {Collection} input array\n*/\nfunction filledAccessors( arr, value ) {\n\tvar i;\n\tfor ( i = 0; i < arr.length; i++ ) {\n\t\tarr.set( value, i );\n\t}\n\treturn arr;\n}\n\n\n// MAIN //\n\n/**\n* Creates a filled array.\n*\n* @param {*} [value] - fill value\n* @param {(NonNegativeInteger|TypedArray|ArrayLikeObject|ArrayBuffer|Iterable)} [arg] - a length, typed array, array-like object, buffer, or iterable\n* @param {NonNegativeInteger} [byteOffset=0] - byte offset\n* @param {NonNegativeInteger} [length] - view length\n* @param {string} [dtype=\"float64\"] - data type\n* @throws {TypeError} must provide a recognized data type\n* @throws {TypeError} must provide a length, typed array, array-like object, buffer, or iterable\n* @throws {Error} creating a generic array from an `ArrayBuffer` is not supported\n* @returns {(TypedArray|Array|ComplexArray)} array or typed array\n*\n* @example\n* var arr = filledarray();\n* // returns \n*\n* @example\n* var arr = filledarray( 1.0, 2 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = filledarray( 1.0, 2, 'float32' );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = filledarray( 1.0, 2, 'generic' );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = filledarray( 1.0, [ 0.5, 0.5 ] );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr = filledarray( 1, [ 5, -3 ], 'int32' );\n* // returns [ 1, 1 ]\n*\n* @example\n* var arr1 = filledarray( 2, [ 5, 3 ], 'int32' );\n* var arr2 = filledarray( 1.0, arr1 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var arr1 = filledarray( 2, [ 5, 3 ], 'int32' );\n* var arr2 = filledarray( 1, arr1, 'uint32' );\n* // returns [ 1, 1 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf, 'float32' );\n* // returns [ 1.0, 1.0, 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf, 8 );\n* // returns [ 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf, 8, 'float32' );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = filledarray( 1.0, buf, 8, 2 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = filledarray( 1, buf, 8, 2, 'int32' );\n* // returns [ 1, 1 ]\n*/\nfunction filledarray() {\n\tvar value;\n\tvar nargs;\n\tvar dtype;\n\tvar ctor;\n\tvar arr;\n\tvar len;\n\tvar arg;\n\n\tnargs = arguments.length;\n\tnargs -= 1;\n\tif ( nargs >= 0 && isString( arguments[ nargs ] ) ) {\n\t\tdtype = arguments[ nargs ];\n\t\tnargs -= 1;\n\t} else {\n\t\tdtype = DEFAULT_DTYPE;\n\t}\n\tctor = ctors( dtype );\n\tif ( ctor === null ) {\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a recognized data type. Value: `%s`.', dtype ) );\n\t}\n\tif ( dtype === 'generic' ) {\n\t\tif ( nargs <= 0 ) {\n\t\t\treturn [];\n\t\t}\n\t\tvalue = arguments[ 0 ];\n\t\targ = arguments[ 1 ];\n\t\tif ( nargs === 1 ) {\n\t\t\tif ( isNonNegativeInteger( arg ) ) {\n\t\t\t\tlen = arg;\n\t\t\t} else if ( isCollection( arg ) ) {\n\t\t\t\tlen = arg.length;\n\t\t\t}\n\t\t\tif ( len !== void 0 ) {\n\t\t\t\treturn filled( value, len );\n\t\t\t}\n\t\t\tif ( isArrayBuffer( arg ) ) {\n\t\t\t\tthrow new Error( 'invalid arguments. Creating a generic array from an ArrayBuffer is not supported.' );\n\t\t\t}\n\t\t\tif ( isObject( arg ) ) {\n\t\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, typed array, or array-like object. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\tif ( !isFunction( arg[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\targ = arg[ ITERATOR_SYMBOL ]();\n\t\t\t\tif ( !isFunction( arg.next ) ) {\n\t\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t\t}\n\t\t\t\treturn filledIterator( arg, value );\n\t\t\t}\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t} else if ( isArrayBuffer( arg ) ) {\n\t\t\tthrow new Error( 'invalid arguments. Creating a generic array from an ArrayBuffer is not supported.' );\n\t\t}\n\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t}\n\tif ( nargs <= 0 ) {\n\t\treturn new ctor( 0 );\n\t}\n\tif ( nargs === 1 ) { // length || array-like || ArrayBuffer || iterable\n\t\targ = arguments[ 1 ];\n\t\tif ( isCollection( arg ) ) {\n\t\t\tarr = new ctor( arg.length );\n\t\t} else if ( isArrayBuffer( arg ) ) {\n\t\t\tarr = new ctor( arg );\n\t\t} else if ( isNonNegativeInteger( arg ) ) {\n\t\t\tarr = new ctor( arg );\n\t\t} else if ( isObject( arg ) ) {\n\t\t\tif ( HAS_ITERATOR_SYMBOL === false ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Environment lacks Symbol.iterator support. Must provide a length, typed array, or array-like object. Value: `%s`.', arg ) );\n\t\t\t}\n\t\t\tif ( !isFunction( arg[ ITERATOR_SYMBOL ] ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t}\n\t\t\targ = arg[ ITERATOR_SYMBOL ]();\n\t\t\tif ( !isFunction( arg.next ) ) {\n\t\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t\t}\n\t\t\tarr = new ctor( iterLength( arg ) );\n\t\t} else {\n\t\t\tthrow new TypeError( format( 'invalid argument. Must provide a length, typed array, array-like object, or an iterable. Value: `%s`.', arg ) );\n\t\t}\n\t} else if ( nargs === 2 ) {\n\t\tarr = new ctor( arguments[1], arguments[2] ); // (ArrayBuffer, byteOffset)\n\t} else {\n\t\tarr = new ctor( arguments[1], arguments[2], arguments[3] ); // (ArrayBuffer, byteOffset, length)\n\t}\n\tif ( arr.length > 0 ) {\n\t\tvalue = arguments[ 0 ];\n\t\tif ( isComplexDataType( dtype ) ) {\n\t\t\tfilledAccessors( arr, value );\n\t\t} else if ( isBooleanDataType( dtype ) ) {\n\t\t\tgfill( arr.length, ( value ) ? 1 : 0, reinterpretBool( arr, 0 ), 1 ); // eslint-disable-line max-len\n\t\t} else {\n\t\t\tgfill( arr.length, value, arr, 1 );\n\t\t}\n\t}\n\treturn arr;\n}\n\n\n// EXPORTS //\n\nmodule.exports = filledarray;\n", "/**\n* @license Apache-2.0\n*\n* Copyright (c) 2020 The Stdlib Authors.\n*\n* Licensed under the Apache License, Version 2.0 (the \"License\");\n* you may not use this file except in compliance with the License.\n* You may obtain a copy of the License at\n*\n* http://www.apache.org/licenses/LICENSE-2.0\n*\n* Unless required by applicable law or agreed to in writing, software\n* distributed under the License is distributed on an \"AS IS\" BASIS,\n* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.\n* See the License for the specific language governing permissions and\n* limitations under the License.\n*/\n\n'use strict';\n\n/**\n* Create a filled array.\n*\n* @module @stdlib/array-filled\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr = filledarray();\n* // returns \n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr = filledarray( 1.0, 2 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr = filledarray( 1.0, 2, 'float32' );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr = filledarray( 1.0, 2, 'generic' );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr = filledarray( 1.0, [ 0.5, 0.5 ] );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr = filledarray( 1, [ 5, -3 ], 'int32' );\n* // returns [ 1, 1 ]\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr1 = filledarray( 10, [ 5, 3 ], 'int32' );\n* var arr2 = filledarray( 1.0, arr1 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var arr1 = filledarray( 1, [ 5, 3 ], 'int32' );\n* var arr2 = filledarray( 2, arr1, 'uint32' );\n* // returns [ 2, 2 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf, 'float32' );\n* // returns [ 1.0, 1.0, 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf, 8 );\n* // returns [ 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var buf = new ArrayBuffer( 16 );\n* var arr = filledarray( 1.0, buf, 8, 'float32' );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = filledarray( 1.0, buf, 8, 2 );\n* // returns [ 1.0, 1.0 ]\n*\n* @example\n* var ArrayBuffer = require( '@stdlib/array-buffer' );\n* var filledarray = require( '@stdlib/array-filled' );\n*\n* var buf = new ArrayBuffer( 32 );\n* var arr = filledarray( 1, buf, 8, 2, 'int32' );\n* // returns [ 1, 1 ]\n*/\n\n// MODULES //\n\nvar main = require( './main.js' );\n\n\n// EXPORTS //\n\nmodule.exports = main;\n"],
+ "mappings": "uGAAA,IAAAA,EAAAC,EAAA,SAAAC,EAAAC,EAAA,cAsBA,IAAIC,EAAoB,QAAS,+DAAgE,EAC7FC,EAAoB,QAAS,gDAAiD,EAC9EC,EAAW,QAAS,0BAA2B,EAAE,YACjDC,EAAuB,QAAS,uCAAwC,EAAE,YAC1EC,EAAe,QAAS,8BAA+B,EACvDC,EAAgB,QAAS,+BAAgC,EACzDC,EAAW,QAAS,0BAA2B,EAC/CC,EAAa,QAAS,4BAA6B,EACnDC,EAAQ,QAAS,qBAAsB,EACvCC,EAAQ,QAAS,6BAA8B,EAC/CC,E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IAAI,UAAWf,EAAQ,wGAAyGe,CAAI,CAAE,OAElIJ,IAAU,EACrBL,EAAM,IAAIO,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAE3CP,EAAM,IAAIO,EAAM,UAAU,CAAC,EAAG,UAAU,CAAC,EAAG,UAAU,CAAC,CAAE,EAE1D,OAAKP,EAAI,OAAS,IACjBD,EAAQ,UAAW,CAAE,EAChBrB,EAAmB4B,CAAM,EAC7BJ,EAAiBF,EAAKD,CAAM,EACjBpB,EAAmB2B,CAAM,EACpCnB,EAAOa,EAAI,OAAUD,EAAU,EAAI,EAAGV,EAAiBW,EAAK,CAAE,EAAG,CAAE,EAEnEb,EAAOa,EAAI,OAAQD,EAAOC,EAAK,CAAE,GAG5BA,CACR,CAKAvB,EAAO,QAAU2B,IC/JjB,IAAIM,EAAO,IAKX,OAAO,QAAUA",
+ "names": ["require_main", "__commonJSMin", "exports", "module", "isComplexDataType", "isBooleanDataType", "isString", "isNonNegativeInteger", "isCollection", "isArrayBuffer", "isObject", "isFunction", "ctors", "gfill", "filled", "reinterpretBool", "hasIteratorSymbolSupport", "ITERATOR_SYMBOL", "iterLength", "defaults", "format", "HAS_ITERATOR_SYMBOL", "DEFAULT_DTYPE", "filledIterator", "it", "value", "arr", "v", "filledAccessors", "i", "filledarray", "nargs", "dtype", "ctor", "len", "arg", "main"]
}
diff --git a/docs/repl.txt b/docs/repl.txt
index 51d3188..47742a8 100644
--- a/docs/repl.txt
+++ b/docs/repl.txt
@@ -2,23 +2,6 @@
{{alias}}( [dtype] )
Creates a filled array.
- The function supports 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 numbers
- - complex64: single-precision complex floating-point numbers
- - int32: 32-bit two's complement signed integers
- - uint32: 32-bit unsigned integers
- - int16: 16-bit two's complement signed integers
- - uint16: 16-bit unsigned integers
- - int8: 8-bit two's complement signed integers
- - uint8: 8-bit unsigned integers
- - uint8c: 8-bit unsigned integers clamped to 0-255
- - generic: generic JavaScript values
-
- The default array data type is `float64`.
-
Parameters
----------
dtype: string (optional)
diff --git a/docs/types/index.d.ts b/docs/types/index.d.ts
index a0c982c..7d17e3f 100644
--- a/docs/types/index.d.ts
+++ b/docs/types/index.d.ts
@@ -28,21 +28,6 @@ import { IterableIterator } from '@stdlib/types/iter';
/**
* Creates a filled array.
*
-* 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 numbers
-* - `complex64`: single-precision complex floating-point numbers
-* - `int32`: 32-bit two's complement signed integers
-* - `uint32`: 32-bit unsigned integers
-* - `int16`: 16-bit two's complement signed integers
-* - `uint16`: 16-bit unsigned integers
-* - `int8`: 8-bit two's complement signed integers
-* - `uint8`: 8-bit unsigned integers
-* - `uint8c`: 8-bit unsigned integers clamped to `0-255`
-* - `generic`: generic JavaScript values
-*
* @param dtype - data type (default: 'float64')
* @returns filled array
*
diff --git a/lib/main.js b/lib/main.js
index 1a36607..df88a74 100644
--- a/lib/main.js
+++ b/lib/main.js
@@ -20,6 +20,8 @@
// MODULES //
+var isComplexDataType = require( '@stdlib/array-base-assert-is-complex-floating-point-data-type' );
+var isBooleanDataType = require( '@stdlib/array-base-assert-is-boolean-data-type' );
var isString = require( '@stdlib/assert-is-string' ).isPrimitive;
var isNonNegativeInteger = require( '@stdlib/assert-is-nonnegative-integer' ).isPrimitive;
var isCollection = require( '@stdlib/assert-is-collection' );
@@ -29,6 +31,7 @@ var isFunction = require( '@stdlib/assert-is-function' );
var ctors = require( '@stdlib/array-ctors' );
var gfill = require( '@stdlib/blas-ext-base-gfill' );
var filled = require( '@stdlib/array-base-filled' );
+var reinterpretBool = require( '@stdlib/strided-base-reinterpret-boolean' );
var hasIteratorSymbolSupport = require( '@stdlib/assert-has-iterator-symbol-support' );
var ITERATOR_SYMBOL = require( '@stdlib/symbol-iterator' );
var iterLength = require( '@stdlib/iter-length' );
@@ -265,10 +268,13 @@ function filledarray() {
arr = new ctor( arguments[1], arguments[2], arguments[3] ); // (ArrayBuffer, byteOffset, length)
}
if ( arr.length > 0 ) {
- if ( /^complex/.test( dtype ) ) {
- filledAccessors( arr, arguments[ 0 ] );
+ value = arguments[ 0 ];
+ if ( isComplexDataType( dtype ) ) {
+ filledAccessors( arr, value );
+ } else if ( isBooleanDataType( dtype ) ) {
+ gfill( arr.length, ( value ) ? 1 : 0, reinterpretBool( arr, 0 ), 1 ); // eslint-disable-line max-len
} else {
- gfill( arr.length, arguments[ 0 ], arr, 1 );
+ gfill( arr.length, value, arr, 1 );
}
}
return arr;
diff --git a/package.json b/package.json
index 59fe6ae..4864124 100644
--- a/package.json
+++ b/package.json
@@ -37,6 +37,8 @@
"url": "https://github.com/stdlib-js/stdlib/issues"
},
"dependencies": {
+ "@stdlib/array-base-assert-is-boolean-data-type": "^0.0.1",
+ "@stdlib/array-base-assert-is-complex-floating-point-data-type": "^0.2.1",
"@stdlib/array-base-filled": "^0.2.1",
"@stdlib/array-ctors": "^0.2.1",
"@stdlib/array-defaults": "^0.2.1",
@@ -49,12 +51,14 @@
"@stdlib/assert-is-string": "^0.2.1",
"@stdlib/blas-ext-base-gfill": "^0.2.1",
"@stdlib/iter-length": "^0.2.1",
+ "@stdlib/strided-base-reinterpret-boolean": "^0.0.1",
"@stdlib/string-format": "^0.2.1",
"@stdlib/symbol-iterator": "^0.2.1",
"@stdlib/types": "^0.3.2",
"@stdlib/error-tools-fmtprodmsg": "^0.2.1"
},
"devDependencies": {
+ "@stdlib/array-bool": "^0.0.1",
"@stdlib/array-buffer": "^0.2.1",
"@stdlib/array-complex128": "^0.2.1",
"@stdlib/array-complex64": "^0.2.1",
@@ -72,8 +76,8 @@
"@stdlib/assert-is-array": "^0.2.1",
"@stdlib/assert-is-typed-array": "^0.2.1",
"@stdlib/assert-is-typed-array-like": "^0.2.1",
- "@stdlib/complex-float32-ctor": "github:stdlib-js/complex-float32-ctor#main",
- "@stdlib/complex-float64-ctor": "github:stdlib-js/complex-float64-ctor#main",
+ "@stdlib/complex-float32-ctor": "^0.0.1",
+ "@stdlib/complex-float64-ctor": "^0.0.1",
"@stdlib/iter-constant": "^0.2.1",
"@stdlib/math-base-special-pow": "^0.2.1",
"@stdlib/random-base-discrete-uniform": "^0.2.1",
diff --git a/test/test.js b/test/test.js
index 31e86df..cdb6eeb 100644
--- a/test/test.js
+++ b/test/test.js
@@ -1,7 +1,7 @@
/**
* @license Apache-2.0
*
-* Copyright (c) 2020 The Stdlib Authors.
+* Copyright (c) 2024 The Stdlib Authors.
*
* Licensed under the Apache License, Version 2.0 (the "License");
* you may not use this file except in compliance with the License.
@@ -33,9 +33,11 @@ var Uint8Array = require( '@stdlib/array-uint8' );
var Uint8ClampedArray = require( '@stdlib/array-uint8c' );
var Complex64Array = require( '@stdlib/array-complex64' );
var Complex128Array = require( '@stdlib/array-complex128' );
+var BooleanArray = require( '@stdlib/array-bool' );
var ArrayBuffer = require( '@stdlib/array-buffer' );
var reinterpret64 = require( '@stdlib/strided-base-reinterpret-complex64' );
var reinterpret128 = require( '@stdlib/strided-base-reinterpret-complex128' );
+var reinterpretBoolean = require( '@stdlib/strided-base-reinterpret-boolean' );
var Complex128 = require( '@stdlib/complex-float64-ctor' );
var Complex64 = require( '@stdlib/complex-float32-ctor' );
var instanceOf = require( '@stdlib/assert-instance-of' );
@@ -740,6 +742,20 @@ tape( 'the function returns a filled array (dtype=float32)', function test( t )
t.end();
});
+tape( 'the function returns a filled array (dtype=bool)', function test( t ) {
+ var expected;
+ var arr;
+
+ expected = new BooleanArray( 0 );
+
+ arr = filledarray( 'bool' );
+ t.strictEqual( instanceOf( arr, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( arr.length, 0, 'returns expected value' );
+ t.deepEqual( arr, expected, 'returns expected value' );
+
+ t.end();
+});
+
tape( 'the function returns a filled array (dtype=complex64)', function test( t ) {
var expected;
var arr;
@@ -964,6 +980,34 @@ tape( 'the function returns a filled array (value=0, dtype=float32, length)', fu
t.end();
});
+tape( 'the function returns a filled array (value=false, dtype=bool, length)', function test( t ) {
+ var expected;
+ var arr;
+
+ expected = new Uint8Array( [ 0, 0, 0, 0, 0 ] );
+
+ arr = filledarray( false, 5, 'bool' );
+ t.strictEqual( instanceOf( arr, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( arr.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' );
+
+ t.end();
+});
+
+tape( 'the function returns a filled array (value=true, dtype=bool, length)', function test( t ) {
+ var expected;
+ var arr;
+
+ expected = new Uint8Array( [ 1, 1, 1, 1, 1 ] );
+
+ arr = filledarray( true, 5, 'bool' );
+ t.strictEqual( instanceOf( arr, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( arr.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( arr, 0 ), expected, 'returns expected value' );
+
+ t.end();
+});
+
tape( 'the function returns a filled array (value=0, dtype=complex128, length)', function test( t ) {
var expected;
var arr;
@@ -1264,6 +1308,30 @@ tape( 'the function returns a filled array (dtype=float32, array)', function tes
t.end();
});
+tape( 'the function returns a filled array (dtype=bool, array)', function test( t ) {
+ var expected;
+ var arr;
+ var out;
+
+ expected = new Uint8Array( [ 0, 0 ] );
+
+ arr = [ 2.0, 2.0 ];
+ out = filledarray( false, arr, 'bool' );
+ t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' );
+
+ expected = new Uint8Array( [ 1, 1 ] );
+
+ arr = [ 2.0, 2.0 ];
+ out = filledarray( true, arr, 'bool' );
+ t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' );
+
+ t.end();
+});
+
tape( 'the function returns a filled array (dtype=complex128, array)', function test( t ) {
var expected;
var arr;
@@ -1472,6 +1540,30 @@ tape( 'the function returns a filled array (dtype=float32, typed array)', functi
t.end();
});
+tape( 'the function returns a filled array (dtype=bool, typed array)', function test( t ) {
+ var expected;
+ var arr;
+ var out;
+
+ expected = new Uint8Array( [ 0, 0, 0, 0 ] );
+
+ arr = new Float64Array( [ 2.0, 2.0, 2.0, 2.0 ] );
+ out = filledarray( false, arr, 'bool' );
+ t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' );
+
+ expected = new Uint8Array( [ 1, 1, 1, 1 ] );
+
+ arr = new Float64Array( [ 2.0, 2.0, 2.0, 2.0 ] );
+ out = filledarray( true, arr, 'bool' );
+ t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' );
+
+ t.end();
+});
+
tape( 'the function returns a filled array (dtype=complex128, typed array)', function test( t ) {
var expected;
var arr;
@@ -1680,6 +1772,30 @@ tape( 'the function returns a filled typed array (dtype=float32, arraybuffer)',
t.end();
});
+tape( 'the function returns a filled typed array (dtype=bool, arraybuffer)', function test( t ) {
+ var expected;
+ var buf;
+ var out;
+
+ expected = new Uint8Array( [ 0, 0 ] );
+
+ buf = new ArrayBuffer( 2 );
+ out = filledarray( false, buf, 'bool' );
+ t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' );
+
+ expected = new Uint8Array( [ 1, 1 ] );
+
+ buf = new ArrayBuffer( 2 );
+ out = filledarray( true, buf, 'bool' );
+ t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' );
+
+ t.end();
+});
+
tape( 'the function returns a filled typed array (dtype=complex128, arraybuffer)', function test( t ) {
var expected;
var buf;
@@ -1882,6 +1998,30 @@ tape( 'the function returns a filled typed array (dtype=float32, arraybuffer, by
t.end();
});
+tape( 'the function returns a filled typed array (dtype=bool, arraybuffer, byteoffset)', function test( t ) {
+ var expected;
+ var buf;
+ var out;
+
+ expected = new Uint8Array( [ 0, 0, 0, 0 ] );
+
+ buf = new ArrayBuffer( 8 );
+ out = filledarray( false, buf, 4, 'bool' );
+ t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' );
+
+ expected = new Uint8Array( [ 1, 1, 1, 1 ] );
+
+ buf = new ArrayBuffer( 8 );
+ out = filledarray( true, buf, 4, 'bool' );
+ t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' );
+
+ t.end();
+});
+
tape( 'the function returns a filled typed array (dtype=complex128, arraybuffer, byteoffset)', function test( t ) {
var expected;
var buf;
@@ -2084,6 +2224,30 @@ tape( 'the function returns a filled typed array (dtype=float32, arraybuffer, by
t.end();
});
+tape( 'the function returns a filled typed array (dtype=bool, arraybuffer, byteoffset, length)', function test( t ) {
+ var expected;
+ var buf;
+ var out;
+
+ expected = new Uint8Array( [ 0, 0, 0, 0 ] );
+
+ buf = new ArrayBuffer( 6 );
+ out = filledarray( false, buf, 1, 4, 'bool' );
+ t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' );
+
+ expected = new Uint8Array( [ 1, 1, 1, 1 ] );
+
+ buf = new ArrayBuffer( 6 );
+ out = filledarray( true, buf, 1, 4, 'bool' );
+ t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' );
+
+ t.end();
+});
+
tape( 'the function returns a filled typed array (dtype=complex128, arraybuffer, byteoffset, length)', function test( t ) {
var expected;
var buf;
@@ -2292,6 +2456,34 @@ tape( 'the function returns a filled array (dtype=float32, iterator)', opts, fun
t.end();
});
+tape( 'the function returns a filled array (dtype=bool, iterator)', opts, function test( t ) {
+ var expected;
+ var arr;
+ var out;
+
+ expected = new Uint8Array( [ 0, 0 ] );
+
+ arr = iterConstant( 3.0, {
+ 'iter': 2
+ });
+ out = filledarray( false, arr, 'bool' );
+ t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' );
+
+ expected = new Uint8Array( [ 1, 1 ] );
+
+ arr = iterConstant( 0.0, {
+ 'iter': 2
+ });
+ out = filledarray( true, arr, 'bool' );
+ t.strictEqual( instanceOf( out, BooleanArray ), true, 'returns expected value' );
+ t.strictEqual( out.length, expected.length, 'returns expected value' );
+ t.deepEqual( reinterpretBoolean( out, 0 ), expected, 'returns expected value' );
+
+ t.end();
+});
+
tape( 'the function returns a filled array (dtype=complex128, iterator)', opts, function test( t ) {
var expected;
var arr;