Skip to content

Latest commit

 

History

History

Folders and files

NameName
Last commit message
Last commit date

parent directory

..
 
 
 
 
 
 
 
 
 
 
 
 
 
 

README.md

isndarrayDescriptor

Test if a value is an ndarray descriptor.

Usage

var isndarrayDescriptor = require( '@stdlib/assert/is-ndarray-descriptor' );

isndarrayDescriptor( value )

Tests if a value is an ndarray descriptor.

var zeros = require( '@stdlib/ndarray/zeros' );

var bool = isndarrayDescriptor( zeros( [ 2, 2 ] ) );
// returns true

A value is an ndarray descriptor if a value is an object with the following properties:

  • dtype: an ndarray's underlying data type.
  • data: array-like object pointing to an underlying data buffer.
  • shape: array-like object containing dimensions.
  • strides: array-like object containing stride lengths.
  • offset: number specifying the index offset.
  • order: string describing the memory layout.

Examples

var zeros = require( '@stdlib/ndarray/zeros' );
var isndarrayDescriptor = require( '@stdlib/assert/is-ndarray-descriptor' );

var bool = isndarrayDescriptor( zeros( [ 2, 2 ] ) );
// returns true

bool = isndarrayDescriptor( [ 1, 2, 3, 4 ] );
// returns false

bool = isndarrayDescriptor( {} );
// returns false

bool = isndarrayDescriptor( null );
// returns false