Home

Awesome

is-real-object npmjs.com The MIT License

Returns true if a value is any type of object, but not an array. Browserify-ready.

standard code style travis build status coverage status dependency status

Why?!

Yea, that's it! Yea, it's so simple as !isArray && isObject. Because all of the others checks that given value is-object or is-plain-object, or even is-extendable and is-obj. And last two are absolutely the same things - returns true if a value is any type of object, including array-ish values.
That being said, just it isn't okey for me to pass array value as options object for example.

Install

npm i is-real-object --save

Usage

For more use-cases see the tests

const isRealObject = require('is-real-object')

returns true

isRealObject({})
isRealObject({foo: 'bar'})
isRealObject(function () {})
isRealObject(arguments)
isRealObject(/foo/)
isRealObject(new Error())
isRealObject(new TypeError())
isRealObject(new Boolean()) // it is object!
isRealObject(new Number()) // it is object!
isRealObject(new String()) // it is object!
isRealObject(new Object())
isRealObject(new Date())
isRealObject(new RegExp())
isRealObject(new RegExp('foo'))
isRealObject(new Function())
isRealObject(new Function('foo'))
isRealObject(Object.create(null))
isRealObject(Object.create({}))
isRealObject(Object.create({a: 'b'}))
isRealObject(Object(0))
isRealObject(Object(1))
isRealObject(Object(false))
isRealObject(Object(true))
isRealObject(Object('foo'))

returns false

isRealObject(new Array())
isRealObject(new Array(2))
isRealObject(Number(123))
isRealObject(String(123))
isRealObject(Boolean(true))
isRealObject(Boolean(false))
isRealObject(Boolean('foo'))
isRealObject(String())
isRealObject(String(123))
isRealObject(String('foo'))
isRealObject([])
isRealObject(['a'])
isRealObject('foo')
isRealObject(null))
isRealObject(undefined)
isRealObject(NaN)
isRealObject(123)
isRealObject(0)
isRealObject(false)
isRealObject(true)
isRealObject()

Related

Contributing

Pull requests and stars are always welcome. For bugs and feature requests, please create an issue.
But before doing anything, please read the CONTRIBUTING.md guidelines.

Charlike Make Reagent new message to charlike freenode #charlike

tunnckocore.tk keybase tunnckocore tunnckoCore npm tunnckoCore twitter tunnckoCore github