Skip to content

Commit 41d2b93

Browse files
committed
Ensure consistent behavior when provided a Node.js Buffer (cross-realm)
1 parent f336d3e commit 41d2b93

File tree

1 file changed

+4
-0
lines changed
  • lib/node_modules/@stdlib/array/dtype/lib

1 file changed

+4
-0
lines changed

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

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

2121
// MODULES //
2222

23+
var isBuffer = require( '@stdlib/assert/is-buffer' );
2324
var isArray = require( '@stdlib/assert/is-array' );
2425
var constructorName = require( '@stdlib/utils/constructor-name' );
2526
var ctor2dtype = require( './ctor2dtype.js' );
@@ -52,6 +53,9 @@ function dtype( value ) {
5253
if ( isArray( value ) ) {
5354
return 'generic';
5455
}
56+
if ( isBuffer( value ) ) {
57+
return null;
58+
}
5559
for ( i = 0; i < NTYPES; i++ ) {
5660
if ( value instanceof CTORS[ i ] ) {
5761
return DTYPES[ i ];

0 commit comments

Comments
 (0)