HTML Preparation code:
AخA
 
1
<script src="https://cdn.jsdelivr.net/npm/lodash@4.17.20/lodash.min.js"></script>
Script Preparation code:
x
 
var sampleObject = {
        "id": "0001",
        "type": "donut",
        "name": "Cake",
        "ppu": 0.55
    };
var sampleObject2 = Object.create(null);
var sampleObject3 = null;
var sampleObject4 = 100;
class Foo {
  constructor() {
    this.a = 1;
  }
}
var sampleObject5 = new Foo();
function isObject(any) {
return
(
        any != null &&
        (any.constructor === Object ||
            (typeof any === 'object' && Object.getPrototypeOf(any) === null))
    )
}
Tests:
  • Lodash isPlainObject

     
    _.isPlainObject(sampleObject);
    _.isPlainObject(sampleObject2);
    _.isPlainObject(sampleObject3);
    _.isPlainObject(sampleObject4);
    _.isPlainObject(sampleObject5);
  • JS Type Check

     
    isObject(sampleObject);
    isObject(sampleObject2);
    isObject(sampleObject3);
    isObject(sampleObject4);
    isObject(sampleObject5);
Rendered benchmark preparation results:

Suite status: <idle, ready to run>

Previous results

Experimental features:

  • Test case name Result
    Lodash isPlainObject
    JS Type Check

    Fastest: N/A

    Slowest: N/A

Latest run results:
Run details: (Test run date: 2 years ago)
Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/106.0.0.0 Safari/537.36
Chrome 106 on Windows
View result in a separate tab
Test name Executions per second
Lodash isPlainObject 532042.6 Ops/sec
JS Type Check 1146496.2 Ops/sec