isWebAssemblyMemory
Test if a value is a WebAssembly memory instance.
Usage
var isWebAssemblyMemory = require( '@stdlib/assert/is-wasm-memory' );
isWebAssemblyMemory( value )
Tests if a value is a WebAssembly memory instance.
var Memory = require( '@stdlib/wasm/memory' );
var mem = new Memory({
'initial': 0
});
var bool = isWebAssemblyMemory( mem );
// returns true
Examples
var Uint8Array = require( '@stdlib/array/uint8' );
var ArrayBuffer = require( '@stdlib/array/buffer' );
var Memory = require( '@stdlib/wasm/memory' );
var isWebAssemblyMemory = require( '@stdlib/assert/is-wasm-memory' );
var mem = new Memory({
'initial': 0
});
var bool = isWebAssemblyMemory( mem );
// returns true
bool = isWebAssemblyMemory( new Uint8Array( 10 ) );
// returns false
bool = isWebAssemblyMemory( new ArrayBuffer( 10 ) );
// returns false