@pacote/is-plain-object
TypeScript icon, indicating that this package has built-in type declarations

2.0.2 • Public • Published

@pacote/is-plain-object

version minified minified + gzip

Checks whether the provided value is a plain JavaScript object.

Installation

yarn add @pacote/is-plain-object

Usage

import { isPlainObject } from '@pacote/is-plain-object'

// These return true:
isPlainObject({})
isPlainObject({ an: 'object' })

// All of these return false:
isPlainObject(undefined)
isPlainObject(null)
isPlainObject(false)
isPlainObject(true)
isPlainObject(NaN)
isPlainObject(Infinity)
isPlainObject(0)
isPlainObject('string')
isPlainObject([])
isPlainObject(new ArrayBuffer(0))
isPlainObject(new Date())
isPlainObject(new Map())
isPlainObject(new Promise())
isPlainObject(new Set())
isPlainObject(new WeakMap())
isPlainObject(new WeakSet())

isPlainObject(o: any): boolean

isPlainObject() takes a single value and checks whether it is a plain object. May be used as a type guard.

License

MIT © Luís Rodrigues.

Readme

Keywords

Package Sidebar

Install

npm i @pacote/is-plain-object

Weekly Downloads

243

Version

2.0.2

License

MIT

Unpacked Size

12.5 kB

Total Files

13

Last publish

Collaborators

  • goblindegook