require-object-coercible-x

2.1.1 • Public • Published

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

require-object-coercible-x

ES6-compliant shim for RequireObjectCoercible.

See: 7.2.1 RequireObjectCoercible ( argument )

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

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')

Package Sidebar

Install

npm i require-object-coercible-x

Weekly Downloads

4,855

Version

2.1.1

License

MIT

Unpacked Size

34.1 kB

Total Files

11

Last publish

Collaborators

  • xotic750