object-utilities-js-2

A collection of utilities dealing with object

Usage no npm install needed!

<script type="module">
  import objectUtilitiesJs2 from 'https://cdn.skypack.dev/object-utilities-js-2';
</script>

README

object-utilities-js

A collection of utilities dealing with object.

Install

Install with npm:

$ npm i object-utilities-js

Usage

with es modules

import { isObject } from 'object-utilities-js'

isObject

Use isObject if you only want to check if the value is an object and not an array, or Element object represents an HTML element, like P, DIV, A, TABLE, or any other HTML element.

true when created by the Object constructor.

isObject(Object.create({}))
//=> true
isObject(Object.create(Object.prototype))
//=> true
isObject({foo: 'bar'})
//=> true
isObject({})
//=> true

false when not created by the Object constructor.

isObject(null)
//=> false
isObject(1)
//=> false
isObject(['foo', 'bar'])
//=> false
isObject([])
//=> false
isObject(()=>{})
//=> false
isObject(Object.create(null))
//=> false
isObject(global.document)
//=> false

Author

Pawel Zielinski

License

Copyright © 2021, [Pawel Zielinski(https://github.com/zielinskipawel). Released under the MIT License.