type-is-object
TypeScript icon, indicating that this package has built-in type declarations

1.0.9 • Public • Published

type-is-object

A utility to check if value is not null and its type is object.

Installation

Using npm

npm i type-is-object

Usage

In Node (CommonJS)

const isObject = require('type-is-object');
 
// on "undefined" -> false
console.log(isObject());
 
// on "null" -> false
console.log(isObject(null));
 
// on "number" -> false
console.log(isObject(100));
 
// on "string" -> false
console.log(isObject('foo'));
 
// on "boolean" -> false
console.log(isObject(true));
 
// on "plain object" -> true
console.log(isObject({ a: 100, b: 200 }));
 
// on "array" -> true
console.log(isObject([1, 2, 3]));
 
// on "function" -> true
console.log(
  isObject(function() {
    return 'bar';
  })
);

In the Browser (ES6 modules):

import isObject from 'type-is-object';

Contributing

If you find any issues, feel free to submit a pull request

Author

iClusterDev

License

This project is under the MIT License

Dependencies (0)

    Dev Dependencies (3)

    Package Sidebar

    Install

    npm i type-is-object

    Weekly Downloads

    5

    Version

    1.0.9

    License

    MIT

    Unpacked Size

    4.65 kB

    Total Files

    5

    Last publish

    Collaborators

    • iclusterdev