https://github.com/xotic750/require-object-coercible-x
ES6-compliant shim for RequireObjectCoercible.
https://github.com/xotic750/require-object-coercible-x
browser ecmascript6 es6 nodejs
Last synced: about 1 year ago
JSON representation
ES6-compliant shim for RequireObjectCoercible.
- Host: GitHub
- URL: https://github.com/xotic750/require-object-coercible-x
- Owner: Xotic750
- License: mit
- Created: 2016-01-20T11:27:49.000Z (over 10 years ago)
- Default Branch: master
- Last Pushed: 2023-01-04T21:54:29.000Z (over 3 years ago)
- Last Synced: 2025-04-30T20:31:47.256Z (about 1 year ago)
- Topics: browser, ecmascript6, es6, nodejs
- Language: JavaScript
- Homepage:
- Size: 3.13 MB
- Stars: 1
- Watchers: 1
- Forks: 0
- Open Issues: 21
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
## require-object-coercible-x
ES6-compliant shim for RequireObjectCoercible.
**See**: [7.2.1 RequireObjectCoercible ( argument )](http://www.ecma-international.org/ecma-262/6.0/#sec-requireobjectcoercible)
### `module.exports(value)` ⇒ string ⏏
The abstract operation RequireObjectCoercible throws an error if argument
is a value that cannot be converted to an Object using ToObject.
**Kind**: Exported function
**Returns**: string - The `value`.
**Throws**:
- TypeError If `value` is a `null` or `undefined`.
| Param | Type | Description |
| ----- | --------------- | --------------------- |
| value | \* | The `value` to check. |
**Example**
```js
import RequireObjectCoercible from 'require-object-coercible-x';
RequireObjectCoercible(); // TypeError
RequireObjectCoercible(null); // TypeError
console.log(RequireObjectCoercible('abc')); // 'abc'
console.log(RequireObjectCoercible(true)); // true
console.log(RequireObjectCoercible(Symbol('foo'))); // Symbol('foo')
```