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

1.1.0 • Public • Published

@xobotyi/is-plain-obj

Check if given value is a plain object

Build status NPM version NPM weekly downloads License Types definition Codacy Code Grade Tests LOC


❤️Please consider starring this project to show your love and support.🙌

Returns true if given value is a plain object (created via {}, new Object() or Object.create(null))

Installation note

This package written in TypeScript and delivered with 3 versions:

  • main field of package.json is pointing to transpiled ES5 version with CJS modules resolution;
  • module field is pointing to transpiled ES5 version with ES modules resolution;
  • esnext field is pointing to the ESNext version with ES modules resolution;

Depending on your targets you may have to use Webpack and/or Babel to pull untranspiled version of package.
See some tips on wiring thing up: https://2ality.com/2017/06/pkg-esnext.html

Usage

import { isObj } from "@xobotyi/is-plain-obj";

isObj(1); // => false

isObj(()=>{}); // => false

isObj(null); // => false

isObj({}); // => true

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

isObj(new (class{})); // => true

Related projects

  • cnbuilder - Yet another classname string builder (the fastest one)
  • @xobotyi/is-obj - Check if given value is an object

Package Sidebar

Install

npm i @xobotyi/is-plain-obj

Weekly Downloads

4

Version

1.1.0

License

MIT

Unpacked Size

8.77 kB

Total Files

8

Last publish

Collaborators

  • xobotyi