Wondering what’s next for npm?Check out our public roadmap! »

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

    1.0.3 • Public • Published

    is-boolean

    Determine if a value is Boolean

    install

    npm i @silen/is-boolean
    

    api

    • declare function isBoolean(val: any): boolean;

    usage

    const { isBoolean } = require('@silen/is-boolean');
    // or
    import { isBoolean } from '@silen/is-boolean';
     
    console.log(isBoolean(new Buffer(4)));
    console.log(isBoolean(Buffer.alloc(4)));
    console.log(isBoolean(undefined));
    console.log(isBoolean(null));
    console.log(isBoolean(''));
    console.log(isBoolean(true));
    console.log(isBoolean(0));
    console.log(isBoolean(1));
    console.log(isBoolean(1.0));
    console.log(isBoolean('string'));
    console.log(isBoolean({}));
    console.log(isBoolean(function foo() {}));
    console.log(isBoolean(Symbol()));
    console.log(isBoolean(new Set));
    console.log(isBoolean(new Map));
    console.log(isBoolean(new WeakMap));
    console.log(isBoolean(new WeakSet));
     
    // or
    console.log(window.Type.isBoolean(new WeakSet));

    This is a demo for testing the usage of isBoolean from @silen/is-boolean module. You can try the others and do likewise.

    others

    Install

    npm i @silen/is-boolean

    DownloadsWeekly Downloads

    1

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    8.24 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar