GitShow/sindresorhus/is-plain-obj
sindresorhus

is-plain-obj

Check if a value is a plain object

by sindresorhus
Star on GitHubForknpm

JavaScript

104 stars9 forks7 contributorsQuiet · 2y agoSince 2015v4.1.0MIT

Meet the team

See all 7 on GitHub →
sindresorhus
sindresorhus17 contributions
ehmicky
ehmicky7 contributions
coreyfarrell
coreyfarrell1 contribution
BendingBender
BendingBender1 contribution
schnittstabil
schnittstabil1 contribution
rocktimsaikia
rocktimsaikia1 contribution
fisker
fisker1 contribution

Languages

View on GitHub →
JavaScript89.4%
TypeScript10.6%

Commit activity

Last 12 weeks · 0 commits

Full graph →

Community health

4 of 6 standards met

Community profile →
85
✓README✓License✓Contributing✓Code of Conduct○Issue Template○PR Template

Recent fixes

View closed PRs →
ehmicky
Upgrade Node version and `devDependencies`MergedPR

This PR runs the CI on Node 22 and upgrades the development dependencies. This also drops support for Node 12, 14 and 16. However, this package does not use any Node code, it is pure JavaScript.

ehmicky · 2y ago
ehmicky
Improve performanceMergedPR

Fixes https://github.com/sindresorhus/is-plain-obj/issues/12 This improves the performance. Benchmarks on Node 18.3.0 on my machine, before the change: After the change: In a nutshell: Some less-used native types (, ) are 60 times faster Most native types (, , , , ) and functions are 5 times faster Plain objects are 50% times faster. This is important since they are the most likely argument. Class instances and many core object types (, , , , , ) are 2-4 times faster is 30% faster is 10% slower , , , are 30% slower. This is the main drawback. However, this seems worthwhile based on the other improvements. is twice slower. It is rarely used though.

ehmicky · 4y ago
ehmicky
Performance improvementClosedIssue

I believe the following code: Should behave the same as the following one: This is because the only case where: is for objects which inherit from . However, for those, . Benchmarks This second code seems to be much faster on my machine (Node 18.3.0): Results (first time is current code, second time is new code, left value is input): : 1s vs 1.5s , : 430ms vs 240ms : 530ms vs 200ms : 600ms vs 245ms : 580ms vs 240ms : 600ms vs 1s then : 3s vs 1s : 4s vs 1s So, overall, the new code performs roughly 33% faster on plain objects, 50-60% faster with native types, and up to 75% faster with non-plain objects (except for ).

ehmicky · 4y ago
Structured data for AI agents

Repository: sindresorhus/is-plain-obj. Description: Check if a value is a plain object Stars: 104, Forks: 9. Primary language: JavaScript. Languages: JavaScript (89.4%), TypeScript (10.6%). License: MIT. Latest release: v4.1.0 (4y ago). Open PRs: 0, open issues: 0. Last activity: 2y ago. Community health: 85%. Top contributors: sindresorhus, ehmicky, coreyfarrell, BendingBender, schnittstabil, rocktimsaikia, fisker.

·@ofershap

Replace github.com with gitshow.dev