Nabbing Pleasant Monads

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

    1.0.3 • Public • Published

    is-weak-map

    Determine if a value is WeakMap

    install

    npm i @silen/is-weak-map
    

    api

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

    usage

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

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

    others

    Install

    npm i @silen/is-weak-map

    DownloadsWeekly Downloads

    8

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    8.26 kB

    Total Files

    9

    Last publish

    Collaborators

    • silentsun