JSPM

object-utils-js

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 2
  • Score
    100M100P100Q23357F
  • License MIT

A collection of utilities dealing with object

Package Exports

  • object-utils-js

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (object-utils-js) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

object-utils-js

A collection of utilities dealing with object.

ES5, tested package

Install

Install with npm:

$ npm i object-utils-js

Usage

with es modules

import { isObject } from 'object-utils-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({}))
isObject(Object.create(Object.prototype))
isObject({foo: 'bar'})
isObject({})

false when not created by the Object constructor.

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

isObjectOrNull

similar to isObject func except null value

true for input parameter.

isObjectOrNull(null)

toObject

convert any input to object

toObject(null)
//=> {}
toObject({})
//=> {}
toObject({a:"a"})
//=> {a:"a"}
toObject(["a"])
//=> {}

Author

Pawel Zielinski

License

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