ES6-compliant shim for ToObject.
npm install to-object-x href="https://travis-ci.org/Xotic750/to-object-x"
title="Travis status"> src="https://travis-ci.org/Xotic750/to-object-x.svg?branch=master"
alt="Travis status" height="18">
href="https://david-dm.org/Xotic750/to-object-x"
title="Dependency status"> alt="Dependency status" height="18"/>
href="https://david-dm.org/Xotic750/to-object-x?type=dev"
title="devDependency status"> alt="devDependency status" height="18"/>
href="https://badge.fury.io/js/to-object-x"
title="npm version"> alt="npm version" height="18">
href="https://www.jsdelivr.com/package/npm/to-object-x"
title="jsDelivr hits"> alt="jsDelivr hits" height="18">
href="https://bettercodehub.com/results/Xotic750/to-object-x"
title="bettercodehub score"> alt="bettercodehub score" height="18">
href="https://coveralls.io/github/Xotic750/to-object-x?branch=master"
title="Coverage Status"> alt="Coverage Status" height="18">
ES6-compliant shim for ToObject.
See: 7.1.13 ToObject ( argument )
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
``js
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'))
``