Neutrinos Peludos Magnéticos
    Have ideas to improve npm?Join in the discussion! »

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

    1.0.3 • Public • Published

    is-string

    Determine if a value is String

    install

    npm i @silen/is-string
    

    api

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

    usage

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

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

    others

    Install

    npm i @silen/is-string

    DownloadsWeekly Downloads

    5

    Version

    1.0.3

    License

    MIT

    Unpacked Size

    7.92 kB

    Total Files

    9

    Last publish

    Collaborators

    • avatar