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

    to-string-x

    2.1.1 • Public • Published

    Travis status Dependency status devDependency status npm version jsDelivr hits bettercodehub score Coverage Status

    to-string-x

    ES6-compliant shim for ToString.

    See: 7.1.12 ToString ( argument )

    module.exports(value)string

    The abstract operation ToString converts argument to a value of type String.

    Kind: Exported function
    Returns: string - The converted value.
    Throws:

    • TypeError If value is a Symbol.
    Param Type Description
    value * The value to convert to a string.

    Example

    import $toString from 'to-string-x';
     
    console.log($toString()); // 'undefined'
    console.log($toString(null)); // 'null'
    console.log($toString('abc')); // 'abc'
    console.log($toString(true)); // 'true'
    console.log($toString(Symbol('foo'))); // TypeError
    console.log($toString(Symbol.iterator)); // TypeError
    console.log($toString(Object(Symbol.iterator))); // TypeError
    console.log($toString(Object.create(null))); // TypeError

    Install

    npm i to-string-x

    DownloadsWeekly Downloads

    10,557

    Version

    2.1.1

    License

    MIT

    Unpacked Size

    48 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar