object assing

Benchmark created on


Test runner

Ready to run.

Testing in
TestOps/sec
object assign
const input = {
  name: "John",
  age: "25",    // This is a string that should be converted to number
  active: "true", // This is a string that should be converted to boolean
  settings: {
    theme: "dark",
    notifications: "false", // This should become boolean
    volume: "75"    // This should become number
  }
};

const obj = {};

Object.assign(obj, input)
ready
spread object
const input = {
  name: "John",
  age: "25",    // This is a string that should be converted to number
  active: "true", // This is a string that should be converted to boolean
  settings: {
    theme: "dark",
    notifications: "false", // This should become boolean
    volume: "75"    // This should become number
  }
};

const obj = {...input};
ready

Revisions

You can edit these tests or add more tests to this page by appending /edit to the URL.