Package Exports
- to-object-x
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (to-object-x) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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
Ifvalue
is anull
orundefined
.
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'))