Git Product home page Git Product logo

is-real-object's Introduction

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

  • is-extendable: Returns true if a value is any of the object types: array, regexp, plain object, function or date. This is useful for determining if a value can be extended,โ€ฆ more
  • is-obj: Check if a value is an object
  • is-plain-obj: Check if a value is a plain object
  • is-plain-object: Returns true if an object was created by the Object constructor.
  • isobject: Returns true if the value is an object and not an array or null.

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

is-real-object's People

Contributors

tunnckocore avatar

Stargazers

 avatar  avatar

Watchers

 avatar

is-real-object's Issues

null?

What about typeof null? That's also object...

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.