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

    to-object-x

    2.2.1 • Public • Published

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

    to-object-x

    ES6-compliant shim for ToObject.

    See: 7.1.13 ToObject ( argument )

    module.exports(value)Object

    The abstract operation ToObject converts argument to a value of type Object.

    Kind: Exported function
    Returns: Object - The value converted to an object.
    Throws:

    • TypeError If value is a null or undefined.
    Param Type Description
    value * The value to convert.

    Example

    import toObject from 'to-object-x';
     
    toObject(); // TypeError
    toObject(null); // TypeError
    console.log(toObject('abc')); // Object('abc')
    console.log(toObject(true)); // Object(true)
    console.log(toObject(Symbol('foo'))); // Object(Symbol('foo'))

    Install

    npm i to-object-x

    DownloadsWeekly Downloads

    8,834

    Version

    2.2.1

    License

    MIT

    Unpacked Size

    35 kB

    Total Files

    11

    Last publish

    Collaborators

    • avatar