Skip to content

Latest commit

 

History

History
28 lines (18 loc) · 520 Bytes

object.md

File metadata and controls

28 lines (18 loc) · 520 Bytes

Object

Object, any non-primitive value

object/is

Confirms if passed value is an object

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.

const ensureObject = require("type/object/ensure");

const obj = {};

ensureObject(obj); // obj
ensureString(null); // Thrown TypeError: null is not an object