Skip to content

Commit 453c7f9

Browse files
committed
refactor: allow array-like objects containing submodes
1 parent 0eaf8b6 commit 453c7f9

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

lib/node_modules/@stdlib/ndarray/ctor/docs/types/index.d.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@
2020

2121
/// <reference types="@stdlib/types"/>
2222

23-
import { Collection } from '@stdlib/types/array';
23+
import { Collection, ArrayLike } from '@stdlib/types/array';
2424
import { ndarray, DataType, Mode, Order, Shape, Strides } from '@stdlib/types/ndarray';
2525
import { Buffer } from 'buffer';
2626

@@ -36,7 +36,7 @@ interface Options {
3636
/**
3737
* Specifies how to handle subscripts which exceed array dimensions on a per dimension basis (default: ['throw']).
3838
*/
39-
submode?: Array<Mode>;
39+
submode?: ArrayLike<Mode>;
4040

4141
/**
4242
* Boolean indicating whether an array should be read-only (default: false).

lib/node_modules/@stdlib/ndarray/ctor/lib/validate.js

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222

2323
var isObject = require( '@stdlib/assert/is-plain-object' );
2424
var hasOwnProp = require( '@stdlib/assert/has-own-property' );
25-
var isArray = require( '@stdlib/assert/is-array' );
25+
var isArrayLikeObject = require( '@stdlib/assert/is-array-like-object' );
2626
var isIndexMode = require( '@stdlib/ndarray/base/assert/is-index-mode' );
2727
var isBoolean = require( '@stdlib/assert/is-boolean' ).isPrimitive;
2828
var format = require( '@stdlib/string/format' );
@@ -37,7 +37,7 @@ var format = require( '@stdlib/string/format' );
3737
* @param {Object} opts - destination object
3838
* @param {Options} options - function options
3939
* @param {string} [options.mode] - specifies how to handle indices which exceed array dimensions
40-
* @param {string} [options.submode] - specifies how to handle subscripts which exceed array dimensions
40+
* @param {StringArray} [options.submode] - specifies how to handle subscripts which exceed array dimensions
4141
* @param {boolean} [options.readonly] - boolean indicating whether an array should be read-only
4242
* @returns {(Error|null)} null or an error object
4343
*
@@ -65,7 +65,7 @@ function validate( opts, options ) {
6565
}
6666
if ( hasOwnProp( options, 'submode' ) ) {
6767
opts.submode = options.submode;
68-
if ( !isArray( opts.submode ) ) {
68+
if ( !isArrayLikeObject( opts.submode ) ) {
6969
return new TypeError( format( 'invalid option. `%s` option must be an array containing recognized modes. Option: `%s`.', 'submode', opts.submode ) );
7070
}
7171
if ( opts.submode.length === 0 ) {

0 commit comments

Comments
 (0)