If IsObject(value) is false, throw a TypeError exception.
npm install assert-is-object-x href="https://travis-ci.org/Xotic750/assert-is-object-x"
title="Travis status"> src="https://travis-ci.org/Xotic750/assert-is-object-x.svg?branch=master"
alt="Travis status" height="18">
href="https://david-dm.org/Xotic750/assert-is-object-x"
title="Dependency status"> alt="Dependency status" height="18"/>
href="https://david-dm.org/Xotic750/assert-is-object-x?type=dev"
title="devDependency status"> alt="devDependency status" height="18"/>
href="https://badge.fury.io/js/assert-is-object-x"
title="npm version"> alt="npm version" height="18">
href="https://www.jsdelivr.com/package/npm/assert-is-object-x"
title="jsDelivr hits"> alt="jsDelivr hits" height="18">
href="https://bettercodehub.com/results/Xotic750/assert-is-object-x"
title="bettercodehub score"> alt="bettercodehub score" height="18">
href="https://coveralls.io/github/Xotic750/assert-is-object-x?branch=master"
title="Coverage Status"> alt="Coverage Status" height="18">
If IsObject(value) is false, throw a TypeError exception.
Tests value to see if it is an object, throws a TypeError if it is
not. Otherwise returns the value.
Kind: Exported function
Returns: \* - Returns value if it is an object.
Throws:
- TypeError Throws if value is not an object.
| Param | Type | Description |
| --------- | ------------------- | ----------------------------- |
| value | \* | The argument to be tested. |
| [message] | string | Optional alternative message. |
Example
``js
import assertIsObject from 'assert-is-object-x';
const primitive = true;
const mySymbol = Symbol('mySymbol');
const symObj = Object(mySymbol);
const object = {};
const fn = function fn() {};
assertIsObject(primitive); // TypeError 'true is not an object'
assertIsObject(mySymbol); // TypeError 'Symbol(mySymbol) is not an object'
assertIsObject(symObj); // Returns symObj.
assertIsObject(object); // Returns object.
assertIsObject(fn); // Returns fn.
``