29 lines
520 B
Plaintext
29 lines
520 B
Plaintext
# Object
|
|
|
|
_Object_, any non-primitive value
|
|
|
|
## `object/is`
|
|
|
|
Confirms if passed value is an object
|
|
|
|
```javascript
|
|
const isObject = require("type/object/is");
|
|
|
|
isObject({}); // true
|
|
isObject(true); // false
|
|
isObject(null); // false
|
|
```
|
|
|
|
## `object/ensure`
|
|
|
|
If given argument is an object, it is returned back. Otherwise `TypeError` is thrown.
|
|
|
|
```javascript
|
|
const ensureObject = require("type/object/ensure");
|
|
|
|
const obj = {};
|
|
|
|
ensureObject(obj); // obj
|
|
ensureString(null); // Thrown TypeError: null is not an object
|
|
```
|