@silen/is-array-buffer
v1.0.3
Published
Check if the parameter is arraybuffer
Downloads
9
Maintainers
Readme
is-array-buffer
Determine if a value is ArrayBuffer
install
npm i @silen/is-array-buffer
api
declare function isArrayBuffer(val: any): boolean;
usage
const { isArrayBuffer } = require('@silen/is-array-buffer');
// or
import { isArrayBuffer } from '@silen/is-array-buffer';
console.log(isArrayBuffer(new Buffer(4)));
console.log(isArrayBuffer(Buffer.alloc(4)));
console.log(isArrayBuffer(undefined));
console.log(isArrayBuffer(null));
console.log(isArrayBuffer(''));
console.log(isArrayBuffer(true));
console.log(isArrayBuffer(0));
console.log(isArrayBuffer(1));
console.log(isArrayBuffer(1.0));
console.log(isArrayBuffer('string'));
console.log(isArrayBuffer({}));
console.log(isArrayBuffer(function foo() {}));
console.log(isArrayBuffer(Symbol()));
console.log(isArrayBuffer(new Set));
console.log(isArrayBuffer(new Map));
console.log(isArrayBuffer(new WeakMap));
console.log(isArrayBuffer(new WeakSet));
// or
console.log(window.Type.isArrayBuffer(new WeakSet));
This is a demo for testing the usage of isArrayBuffer
from @silen/is-array-buffer
module. You can try the others and do likewise.
others
- type
- isArray
- isUndefined
- isNull
- isBoolean
- isBuffer
- isFormData
- isArrayBufferView
- isString
- isNumber
- isObject
- isPlainObject
- isDate
- isArguments
- isFile
- isBlob
- isFunction
- isSymbol
- isRegExp
- isInt8Array
- isUint8Array
- isUint8ClampedArray
- isInt16Array
- isUint16Array
- isInt32Array
- isUint32Array
- isFloat32Array
- isFloat64Array
- isError
- isPromise
- isSet
- isWeakSet
- isMap
- isWeakMap
- isStream
- isURLSearchParams