@@ -25,7 +25,7 @@ <h1><a href="index.html">All files</a> main.js</h1>
2525 < div class ='fl pad1y space-right2 '>
2626 < span class ="strong "> 100% </ span >
2727 < span class ="quiet "> Statements</ span >
28- < span class ='fraction '> 118/118 </ span >
28+ < span class ='fraction '> 120/120 </ span >
2929 </ div >
3030
3131
@@ -46,7 +46,7 @@ <h1><a href="index.html">All files</a> main.js</h1>
4646 < div class ='fl pad1y space-right2 '>
4747 < span class ="strong "> 100% </ span >
4848 < span class ="quiet "> Lines</ span >
49- < span class ='fraction '> 118/118 </ span >
49+ < span class ='fraction '> 120/120 </ span >
5050 </ div >
5151
5252
@@ -181,7 +181,9 @@ <h1><a href="index.html">All files</a> main.js</h1>
181181< a name ='L116 '> </ a > < a href ='#L116 '> 116</ a >
182182< a name ='L117 '> </ a > < a href ='#L117 '> 117</ a >
183183< a name ='L118 '> </ a > < a href ='#L118 '> 118</ a >
184- < a name ='L119 '> </ a > < a href ='#L119 '> 119</ a > </ td > < td class ="line-coverage quiet "> < span class ="cline-any cline-yes "> 1x</ span >
184+ < a name ='L119 '> </ a > < a href ='#L119 '> 119</ a >
185+ < a name ='L120 '> </ a > < a href ='#L120 '> 120</ a >
186+ < a name ='L121 '> </ a > < a href ='#L121 '> 121</ a > </ td > < td class ="line-coverage quiet "> < span class ="cline-any cline-yes "> 1x</ span >
185187< span class ="cline-any cline-yes "> 1x</ span >
186188< span class ="cline-any cline-yes "> 1x</ span >
187189< span class ="cline-any cline-yes "> 1x</ span >
@@ -246,44 +248,43 @@ <h1><a href="index.html">All files</a> main.js</h1>
246248< span class ="cline-any cline-yes "> 1x</ span >
247249< span class ="cline-any cline-yes "> 1x</ span >
248250< span class ="cline-any cline-yes "> 1x</ span >
249- < span class ="cline-any cline-yes "> 1x</ span >
250- < span class ="cline-any cline-yes "> 1x</ span >
251- < span class ="cline-any cline-yes "> 90x</ span >
252- < span class ="cline-any cline-yes "> 90x</ span >
253- < span class ="cline-any cline-yes "> 90x</ span >
254- < span class ="cline-any cline-yes "> 90x</ span >
255- < span class ="cline-any cline-yes "> 90x</ span >
256- < span class ="cline-any cline-yes "> 90x</ span >
257- < span class ="cline-any cline-yes "> 90x</ span >
251+ < span class ="cline-any cline-yes "> 94x</ span >
252+ < span class ="cline-any cline-yes "> 94x</ span >
253+ < span class ="cline-any cline-yes "> 94x</ span >
254+ < span class ="cline-any cline-yes "> 94x</ span >
255+ < span class ="cline-any cline-yes "> 94x</ span >
256+ < span class ="cline-any cline-yes "> 94x</ span >
257+ < span class ="cline-any cline-yes "> 94x</ span >
258+ < span class ="cline-any cline-yes "> 94x</ span >
258259< span class ="cline-any cline-yes "> 20x</ span >
259260< span class ="cline-any cline-yes "> 20x</ span >
260- < span class ="cline-any cline-yes "> 70x</ span >
261- < span class ="cline-any cline-yes "> 70x</ span >
262- < span class ="cline-any cline-yes "> 90x</ span >
263- < span class ="cline-any cline-yes "> 56x</ span >
264- < span class ="cline-any cline-yes "> 56x</ span >
261+ < span class ="cline-any cline-yes "> 74x</ span >
262+ < span class ="cline-any cline-yes "> 94x</ span >
263+ < span class ="cline-any cline-yes "> 60x</ span >
264+ < span class ="cline-any cline-yes "> 60x</ span >
265265< span class ="cline-any cline-yes "> 8x</ span >
266266< span class ="cline-any cline-yes "> 8x</ span >
267- < span class ="cline-any cline-yes "> 56x</ span >
268- < span class ="cline-any cline-yes "> 20x</ span >
269- < span class ="cline-any cline-yes "> 9x</ span >
270- < span class ="cline-any cline-yes "> 9x</ span >
267+ < span class ="cline-any cline-yes "> 52x</ span >
268+ < span class ="cline-any cline-yes "> 60x</ span >
269+ < span class ="cline-any cline-yes "> 24x</ span >
270+ < span class ="cline-any cline-yes "> 13x</ span >
271+ < span class ="cline-any cline-yes "> 13x</ span >
271272< span class ="cline-any cline-yes "> 11x</ span >
272- < span class ="cline-any cline-yes "> 56x </ span >
273+ < span class ="cline-any cline-yes "> 60x </ span >
273274< span class ="cline-any cline-yes "> 28x</ span >
274275< span class ="cline-any cline-yes "> 28x</ span >
275- < span class ="cline-any cline-yes "> 56x </ span >
276+ < span class ="cline-any cline-yes "> 60x </ span >
276277< span class ="cline-any cline-yes "> 21x</ span >
277- < span class ="cline-any cline-yes "> 56x </ span >
278+ < span class ="cline-any cline-yes "> 60x </ span >
278279< span class ="cline-any cline-yes "> 18x</ span >
279280< span class ="cline-any cline-yes "> 18x</ span >
280- < span class ="cline-any cline-yes "> 56x </ span >
281+ < span class ="cline-any cline-yes "> 60x </ span >
281282< span class ="cline-any cline-yes "> 10x</ span >
282283< span class ="cline-any cline-yes "> 10x</ span >
283- < span class ="cline-any cline-yes "> 56x </ span >
284+ < span class ="cline-any cline-yes "> 60x </ span >
284285< span class ="cline-any cline-yes "> 9x</ span >
285286< span class ="cline-any cline-yes "> 9x</ span >
286- < span class ="cline-any cline-yes "> 90x </ span >
287+ < span class ="cline-any cline-yes "> 94x </ span >
287288< span class ="cline-any cline-yes "> 14x</ span >
288289< span class ="cline-any cline-yes "> 14x</ span >
289290< span class ="cline-any cline-yes "> 14x</ span >
@@ -293,7 +294,10 @@ <h1><a href="index.html">All files</a> main.js</h1>
293294< span class ="cline-any cline-yes "> 53x</ span >
294295< span class ="cline-any cline-yes "> 53x</ span >
295296< span class ="cline-any cline-yes "> 53x</ span >
296- < span class ="cline-any cline-yes "> 90x</ span >
297+ < span class ="cline-any cline-yes "> 53x</ span >
298+ < span class ="cline-any cline-yes "> 53x</ span >
299+ < span class ="cline-any cline-yes "> 53x</ span >
300+ < span class ="cline-any cline-yes "> 94x</ span >
297301< span class ="cline-any cline-yes "> 1x</ span >
298302< span class ="cline-any cline-yes "> 1x</ span >
299303< span class ="cline-any cline-yes "> 1x</ span >
@@ -336,20 +340,18 @@ <h1><a href="index.html">All files</a> main.js</h1>
336340// MAIN //
337341
338342/**
339- * Copy an input ndarray to a new ndarray having the same shape and data type.
343+ * Copies an input ndarray to a new ndarray having the same shape and data type.
340344*
341345* @param {ndarray} x - input array
342346* @param {Options} [options] - function options
343- * @param {string } [options.dtype] - output array data type (overrides the input array's inferred data type)
347+ * @param {* } [options.dtype] - output array data type (overrides the input array's inferred data type)
344348* @param {string} [options.order] - specifies whether the output array should be 'row-major' (C-style) or 'column-major' (Fortran-style) (overrides the input array's inferred order)
345- * @param {(NonNegativeIntegerArray|NonNegativeInteger)} [options.shape] - output array shape (overrides the input array's inferred shape)
346349* @param {string} [options.mode="throw"] - specifies how to handle indices which exceed array dimensions
347350* @param {StringArray} [options.submode=["throw"]] - specifies how to handle subscripts which exceed array dimensions on a per dimension basis
348351* @throws {TypeError} first argument must be an ndarray-like object
349352* @throws {TypeError} options argument must be an object
350353* @throws {TypeError} `dtype` option must be a supported ndarray data type
351354* @throws {TypeError} `order` option must be a supported order
352- * @throws {TypeError} `shape` option must be either a nonnegative integer or an array of nonnegative integers
353355* @throws {TypeError} must provide valid options
354356* @returns {ndarray} ndarray
355357*
@@ -370,25 +372,26 @@ <h1><a href="index.html">All files</a> main.js</h1>
370372 var options;
371373 var opts;
372374 var sh;
375+ var dt;
373376 var o;
374377
375378 if ( !isndarrayLike( x ) ) {
376379 throw new TypeError( format( 'invalid argument. First argument must be an ndarray-like object. Value: `%s`.', x ) );
377380 }
378- // Resolve function options:
379381 opts = {};
380382 if ( arguments.length > 1 ) {
381383 options = arguments[ 1 ];
382384 if ( !isPlainObject( options ) ) {
383385 throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
384386 }
387+ dt = getDType( x );
385388 if ( hasOwnProp( options, 'dtype' ) ) {
386- if ( !isMostlySafeCast( getDType( x ) , options.dtype ) ) {
387- throw new TypeError( format( 'invalid option. `%s` option must be safely castable. Option: `%s`.', 'dtype', options.dtype ) );
389+ if ( !isMostlySafeCast( dt , options.dtype ) ) {
390+ throw new TypeError( format( 'invalid option. First argument cannot be safely cast to the specified data type. Input data type: %s. Option: `%s`.', String( dt ), String( options.dtype ) ) );
388391 }
389392 opts.dtype = options.dtype;
390393 } else {
391- opts.dtype = getDType( x ) ;
394+ opts.dtype = dt ;
392395 }
393396 if ( hasOwnProp( options, 'order' ) ) {
394397 opts.order = options.order;
@@ -407,9 +410,12 @@ <h1><a href="index.html">All files</a> main.js</h1>
407410 }
408411 sh = getShape( x );
409412
410- // Create a copy of the input ndarray :
413+ // Initialize an output array :
411414 o = empty( sh, opts );
415+
416+ // Copy the input array to the output array:
412417 assign( [ x, o ] );
418+
413419 return o;
414420}
415421
@@ -424,7 +430,7 @@ <h1><a href="index.html">All files</a> main.js</h1>
424430 < div class ='footer quiet pad2 space-top1 center small '>
425431 Code coverage generated by
426432 < a href ="https://istanbul.js.org/ " target ="_blank " rel ="noopener noreferrer "> istanbul</ a >
427- at 2025-11-10T09 :04:13.378Z
433+ at 2025-11-12T07 :04:13.800Z
428434 </ div >
429435 < script src ="prettify.js "> </ script >
430436 < script >
0 commit comments