New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details
Socket
Book a DemoSign in
Socket

@stdlib/assert-is-arraybuffer-view

Package Overview
Dependencies
Maintainers
4
Versions
8
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/assert-is-arraybuffer-view

Test if a value is an `ArrayBuffer` view.

Source
npmnpm
Version
0.0.1
Version published
Weekly downloads
9
50%
Maintainers
4
Weekly downloads
 
Created
Source

isArrayBufferView

NPM version Build Status Coverage Status dependencies

Test if a value is an ArrayBuffer view.

Installation

npm install @stdlib/assert-is-arraybuffer-view

Usage

var isArrayBufferView = require( '@stdlib/assert-is-arraybuffer-view' );

isArrayBufferView( value )

Tests if a value is an ArrayBuffer view such as a DataView or TypedArray.

var Int8Array = require( '@stdlib/array-int8' );
var ArrayBuffer = require( '@stdlib/array-buffer' );

var bool = isArrayBufferView( new Int8Array( 10 ) );
// returns true

bool = isArrayBufferView( new ArrayBuffer( 10 ) );
// returns false

Examples

var Float32Array = require( '@stdlib/array-float32' );
var Float64Array = require( '@stdlib/array-float64' );
var Int8Array = require( '@stdlib/array-int8' );
var Int16Array = require( '@stdlib/array-int16' );
var Int32Array = require( '@stdlib/array-int32' );
var Uint16Array = require( '@stdlib/array-uint16' );
var ArrayBuffer = require( '@stdlib/array-buffer' );
var isArrayBufferView = require( '@stdlib/assert-is-arraybuffer-view' );

var bool = isArrayBufferView( new Int8Array( 10 ) );
// returns true

bool = isArrayBufferView( new Int16Array( 10 ) );
// returns true

bool = isArrayBufferView( new Uint16Array( 10 ) );
// returns true

bool = isArrayBufferView( new Int32Array( 10 ) );
// returns true

bool = isArrayBufferView( new Float64Array( 10 ) );
// returns true

bool = isArrayBufferView( new Float32Array( 10 ) );
// returns true

bool = isArrayBufferView( new ArrayBuffer( 10 ) );
// returns false

bool = isArrayBufferView( [] );
// returns false

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

bool = isArrayBufferView( null );
// returns false

Notice

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

Chat

License

See LICENSE.

Copyright © 2016-2021. The Stdlib Authors.

Keywords

stdlib

FAQs

Package last updated on 22 Aug 2021

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts