@stdlib/assert-is-same-typed-array-like
v0.1.1
Published
Test if two arguments are both typed-array-like object and have the same values.
Readme
isSameTypedArrayLike
Test if two arguments are both typed-array-like objects and have the same values.
Installation
npm install @stdlib/assert-is-same-typed-array-likeUsage
var isSameTypedArrayLike = require( '@stdlib/assert-is-same-typed-array-like' );isSameTypedArrayLike( v1, v2 )
Tests if two arguments are both typed-array-like objects and have the same values.
var Int8Array = require( '@stdlib/array-int8' );
var Int16Array = require( '@stdlib/array-int16' );
var x = new Int8Array( [ 1.0, 2.0 ] );
var y = new Int16Array( [ 1.0, 2.0 ] );
var bool = isSameTypedArrayLike( x, y );
// returns true
bool = isSameTypedArrayLike( x, new Int8Array( [ -1.0, 2.0 ] ) );
// returns falseExamples
var Int8Array = require( '@stdlib/array-int8' );
var Int16Array = require( '@stdlib/array-int16' );
var isSameTypedArrayLike = require( '@stdlib/assert-is-same-typed-array-like' );
var x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
var y = new Int16Array( [ 1.0, 2.0, 3.0 ] );
var out = isSameTypedArrayLike( x, y );
// returns true
x = new Int8Array( [ 1.0, 2.0, 3.0 ] );
y = new Int16Array( [ 1.0, 2.0, 4.0 ] );
out = isSameTypedArrayLike( x, y );
// returns falseNotice
This package is part of stdlib, a standard library for JavaScript and Node.js, with an emphasis on numerical and scientific computing. The library provides a collection of robust, high performance libraries for mathematics, statistics, streams, utilities, and more.
For more information on the project, filing bug reports and feature requests, and guidance on how to develop stdlib, see the main project repository.
Community
License
See LICENSE.
Copyright
Copyright © 2016-2026. The Stdlib Authors.
