import { bench, describe } from 'vitest';
import { isPlainObject as isPlainObjectToolkit } from 'es-toolkit';
import { isPlainObject as isPlainObjectCompatToolkit } from 'es-toolkit/compat';
import lodash from 'lodash';

const { isPlainObject: isPlainObjectLodash } = lodash;

const object = Object.create(null);
const buffer = Buffer.from('hello, world');

describe('isPlainObject', () => {
  bench('es-toolkit/isPlainObject', () => {
    isPlainObjectToolkit({});
    isPlainObjectToolkit([]);
    isPlainObjectToolkit(null);
    isPlainObjectToolkit(object);
    isPlainObjectToolkit(buffer);
  });

  bench('es-toolkit/compat/isPlainObject', () => {
    isPlainObjectCompatToolkit({});
    isPlainObjectCompatToolkit([]);
    isPlainObjectCompatToolkit(null);
    isPlainObjectCompatToolkit(object);
    isPlainObjectCompatToolkit(buffer);
  });

  bench('lodash/isPlainObject', () => {
    isPlainObjectLodash({});
    isPlainObjectLodash([]);
    isPlainObjectLodash(null);
    isPlainObjectLodash(object);
    isPlainObjectLodash(buffer);
  });
});
