Skip to content

Commit a8d0764

Browse files
committed
Use base utility
1 parent 5527421 commit a8d0764

1 file changed

Lines changed: 2 additions & 21 deletions

File tree

  • lib/node_modules/@stdlib/array/filled/lib

lib/node_modules/@stdlib/array/filled/lib/main.js

Lines changed: 2 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -29,6 +29,7 @@ var isFunction = require( '@stdlib/assert/is-function' );
2929
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
3030
var ctors = require( '@stdlib/array/ctors' );
3131
var gfill = require( '@stdlib/blas/ext/base/gfill' );
32+
var filled = require( '@stdlib/array/base/filled' );
3233
var hasIteratorSymbolSupport = require( '@stdlib/assert/has-iterator-symbol-support' );
3334
var ITERATOR_SYMBOL = require( '@stdlib/symbol/iterator' );
3435

@@ -40,26 +41,6 @@ var HAS_ITERATOR_SYMBOL = hasIteratorSymbolSupport();
4041

4142
// FUNCTIONS //
4243

43-
/**
44-
* Creates a filled "generic" array.
45-
*
46-
* @private
47-
* @param {NonNegativeInteger} len - array length
48-
* @param {*} value - fill value
49-
* @returns {Array} filled array
50-
*/
51-
function filled( len, value ) {
52-
var arr;
53-
var i;
54-
55-
// Manually push elements in order to ensure "fast" elements...
56-
arr = [];
57-
for ( i = 0; i < len; i++ ) {
58-
arr.push( value );
59-
}
60-
return arr;
61-
}
62-
6344
/**
6445
* Creates a filled "generic" array from an iterator.
6546
*
@@ -211,7 +192,7 @@ function filledarray() {
211192
len = arg.length;
212193
}
213194
if ( len !== void 0 ) {
214-
return filled( len, value );
195+
return filled( value, len );
215196
}
216197
if ( isArrayBuffer( arg ) ) {
217198
throw new Error( 'invalid arguments. Creating a generic array from an ArrayBuffer is not supported.' );

0 commit comments

Comments
 (0)