Skip to content

Commit 2a9750e

Browse files
authored
refactor: avoid unnecessarily calling hasOwnProp
Signed-off-by: Athan <[email protected]>
1 parent ecc61dd commit 2a9750e

File tree

1 file changed

+8
-6
lines changed
  • lib/node_modules/@stdlib/blas/ext/last-index-of/lib

1 file changed

+8
-6
lines changed

lib/node_modules/@stdlib/blas/ext/last-index-of/lib/assign.js

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -188,12 +188,14 @@ function assign( x, searchElement, fromIndex, out ) {
188188
options = arguments[ 4 ];
189189
hasOptions = true;
190190
}
191-
if ( hasOptions && !isPlainObject( options ) ) {
192-
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
193-
}
194-
// Resolve provided options...
195-
if ( hasOwnProp( options, 'dim' ) ) {
196-
opts.dims[ 0 ] = options.dim;
191+
if ( hasOptions ) {
192+
if ( !isPlainObject( options ) ) {
193+
throw new TypeError( format( 'invalid argument. Options argument must be an object. Value: `%s`.', options ) );
194+
}
195+
// Resolve provided options...
196+
if ( hasOwnProp( options, 'dim' ) ) {
197+
opts.dims[ 0 ] = options.dim;
198+
}
197199
}
198200
// Resolve the list of non-reduced dimensions:
199201
sh = getShape( x );

0 commit comments

Comments
 (0)