# is-plain-obj

> Check if a value is a plain object

Latest version **4.1.0** (published 2022-06-15) · MIT license · 0 weekly downloads

## Install

```sh
npm install is-plain-obj
pnpm add is-plain-obj
yarn add is-plain-obj
bun add is-plain-obj
```

## Health

**Score 45/100 (D)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities; high maintenance score; high quality score.

Warnings: low downloads.

Negative: abandoned.

## Facts

| | |
|---|---|
| Version | 4.1.0 |
| Published | 2022-06-15 |
| First published | 2015-07-11 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM |
| Node | >=12 |
| Dependencies | 0 |
| Unpacked size | 4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 105 |
| Author | Sindre Sorhus |
| Maintainers | sindresorhus |
| Keywords | object, is, check, test, type, plain, vanilla, pure, simple |

## Links

- npm: https://www.npmjs.com/package/is-plain-obj
- Repository: https://github.com/sindresorhus/is-plain-obj
- Homepage: https://github.com/sindresorhus/is-plain-obj#readme
- Issues: https://github.com/sindresorhus/is-plain-obj/issues
- Funding: https://github.com/sponsors/sindresorhus
- npm.io page: https://npm.io/package/is-plain-obj

## Alternatives

- [memory-cache](https://npm.io/package/memory-cache.md) — 795.0K weekly downloads
- [@httptoolkit/proxy-agent](https://npm.io/package/@httptoolkit/proxy-agent.md) — 11.2K weekly downloads
- [express-cache-controller](https://npm.io/package/express-cache-controller.md) — 5.3K weekly downloads
- [http-cache-middleware](https://npm.io/package/http-cache-middleware.md) — 4.5K weekly downloads
- [cache2](https://npm.io/package/cache2.md) — 1.5K weekly downloads

## Recent versions

- 4.1.0 (latest) — 2022-06-15
- 4.0.0 — 2021-04-16
- 3.0.0 — 2020-10-12
- 2.1.0 — 2020-01-21
- 2.0.0 — 2019-04-20
- 1.1.0 — 2015-11-05
- 1.0.0 — 2015-07-11

## README

# is-plain-obj

> Check if a value is a plain object

An object is plain if it's created by either `{}`, `new Object()`, or `Object.create(null)`.

## Install

```
$ npm install is-plain-obj
```

## Usage

```js
import isPlainObject from 'is-plain-obj';
import {runInNewContext} from 'node:vm';

isPlainObject({foo: 'bar'});
//=> true

isPlainObject(new Object());
//=> true

isPlainObject(Object.create(null));
//=> true

// This works across realms
isPlainObject(runInNewContext('({})'));
//=> true

isPlainObject([1, 2, 3]);
//=> false

class Unicorn {}
isPlainObject(new Unicorn());
//=> false

isPlainObject(Math);
//=> false
```

## Related

- [is-obj](https://github.com/sindresorhus/is-obj) - Check if a value is an object
- [is](https://github.com/sindresorhus/is) - Type check values

---

<div align="center">
	<b>
		<a href="https://tidelift.com/subscription/pkg/npm-is-plain-obj?utm_source=npm-is-plain-obj&utm_medium=referral&utm_campaign=readme">Get professional support for this package with a Tidelift subscription</a>
	</b>
	<br>
	<sub>
		Tidelift helps make open source sustainable for maintainers while giving companies<br>assurances about security, maintenance, and licensing for their dependencies.
	</sub>
</div>

---
_Source: https://npm.io/package/is-plain-obj · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
