Necesito Programar Más

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

    1.0.3 • Public • Published

    is-error

    Determine if a value is Error

    install

    npm i @silen/is-error
    

    api

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

    usage

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

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

    others

    Install

    npm i @silen/is-error

    DownloadsWeekly Downloads

    9

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    8.13 kB

    Total Files

    9

    Last publish

    Collaborators

    • silentsun