Have ideas to improve npm?Join in the discussion! »

    @silen/is-array-buffer
    TypeScript icon, indicating that this package has built-in type declarations

    1.0.3 • Public • Published

    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

    Install

    npm i @silen/is-array-buffer

    DownloadsWeekly Downloads

    0

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    8.48 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar