JSPM

type-is-plain-object

1.0.2
  • ESM via JSPM
  • ES Module Entrypoint
  • Export Map
  • Keywords
  • License
  • Repository URL
  • TypeScript Types
  • README
  • Created
  • Published
  • Downloads 6
  • Score
    100M100P100Q33911F
  • License MIT

A utility to test if a 'value' has a type of 'Object' and it was created by the Object constructor

Package Exports

  • type-is-plain-object

This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (type-is-plain-object) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.

Readme

type-is-plain-object

A utility to test if a 'value' has a type of 'Object' and it was created by the Object constructor.

Installation

Using npm

npm i type-is-plain-object

Usage

In Node (CommonJS)

const isPlainObject = require('type-is-plain-object');

// on "undefined" -> false
console.log(isPlainObject());

// on "null" -> false
console.log(isPlainObject(null));

// on "number" -> false
console.log(isPlainObject(100));

// on "string" -> false
console.log(isPlainObject('foo'));

// on "boolean" -> false
console.log(isPlainObject(true));

// on "plain object" -> true
console.log(isPlainObject({ a: 100, b: 200 }));

// on "array" -> false
console.log(isPlainObject([1, 2, 3]));

// on "function" -> false
console.log(
  isPlainObject(function() {
    return 'bar';
  })
);

In the Browser (ES6 modules):

import isPlainObject from 'type-is-plain-object';

Contributing

If you find any issues, feel free to submit a pull request

Author

iClusterDev

License

This project is under the MIT License