@kikiki_kiki/is-object

Determine if the parameter is Object. Verifies if it not an array, null, function, Date, RegExp, Symbol and Class Object.

Usage no npm install needed!

<script type="module">
  import kikikiKikiIsObject from 'https://cdn.skypack.dev/@kikiki_kiki/is-object';
</script>

README

NPM version Build Status codecov MIT License

isObject

isObject( val: any ) #=> Boolean
Determine if the parameter is Object ({}). Verifies if it not an array, null, function, Date, RegExp, Symbol and Class Object.

test

$ npm run test

build

$ npm run build

install

$ npm install @kikiki_kiki/is-object

usage

import isObject from '@kikiki_kiki/is-object';
isObject({});
// => true

isObject([]);
// => false

isObject(null);
// => false

isObject(undefined);
// => false

isObject(true);
// => false
isObject(false);
// => false

isObject(NaN);
// => false

isObject(1);
// => false
isObject(-1);
// => false

isObject("");
// => false

function, Date, RegExp, Symbol, Class object return false

function

const func = function() { return true; }
isObject(func);
// => false

Date

const date = new Date();
isObject(date);
// => false

RegExp

const regex1 = /\w+/;
expect( isObject( regex1 ) ).toBe(false);
// => false

const regex2 = new RegExp('\\w+');
expect( isObject( regex2 ) ).toBe(false);
// => false

Symbol

const symbol1 = Symbol();
isObject(symbol1);
// => false

const symbol2 = Symbol( {} );
isObject(symbol2);
// => false

Class

class MyClass {
  constructor() {}
};
const classObj = new MyClass();
isObject(classObj);
// => false