🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

@stdlib/assert-is-plain-object

Package Overview
Dependencies
Maintainers
4
Versions
12
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@stdlib/assert-is-plain-object

Test if a value is a plain object.

0.2.2
latest
Source
npm
Version published
Weekly downloads
319K
-22.66%
Maintainers
4
Weekly downloads
 
Created

What is @stdlib/assert-is-plain-object?

@stdlib/assert-is-plain-object is a utility package that provides a function to check if a value is a plain object. A plain object is an object created by the Object constructor or with an object literal.

What are @stdlib/assert-is-plain-object's main functionalities?

Check if a value is a plain object

This feature allows you to check if a given value is a plain object. In the code sample, the function `isPlainObject` is used to check if `obj` is a plain object, which returns `true`.

const isPlainObject = require('@stdlib/assert-is-plain-object');

const obj = { 'a': 1, 'b': 2 };
const result = isPlainObject(obj);
console.log(result); // true

Check if a non-object value is a plain object

This feature allows you to check if a non-object value is a plain object. In the code sample, the function `isPlainObject` is used to check if `notAnObject` is a plain object, which returns `false`.

const isPlainObject = require('@stdlib/assert-is-plain-object');

const notAnObject = 42;
const result = isPlainObject(notAnObject);
console.log(result); // false

Check if an array is a plain object

This feature allows you to check if an array is a plain object. In the code sample, the function `isPlainObject` is used to check if `arr` is a plain object, which returns `false`.

const isPlainObject = require('@stdlib/assert-is-plain-object');

const arr = [1, 2, 3];
const result = isPlainObject(arr);
console.log(result); // false

Other packages similar to @stdlib/assert-is-plain-object

Keywords

stdlib

FAQs

Package last updated on 27 Jul 2024

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts