refactor: automatically sort imports
[benchmarks-js.git] / deep-clone-object.mjs
index be98817da7967080ecec8d95b60e1a8edb3be266..989a04f907e3bf78b51a92d754d2909c2ff19af8 100644 (file)
@@ -1,8 +1,9 @@
 /* eslint-disable no-unused-vars */
 import Benchmark from 'benny'
-import _ from 'lodash'
-import clone from 'just-clone'
 import deepClone from 'deep-clone'
+import clone from 'just-clone'
+import _ from 'lodash'
+
 import { generateRandomObject } from './benchmark-utils.mjs'
 
 const object = generateRandomObject()
@@ -10,19 +11,19 @@ const object = generateRandomObject()
 Benchmark.suite(
   `Deep clone object with ${Object.keys(object).length} keys`,
   Benchmark.add('JSON stringify/parse', (obj = object) => {
-    const objClone = JSON.parse(JSON.stringify(obj))
+    const objCloned = JSON.parse(JSON.stringify(obj))
   }),
   Benchmark.add('structuredClone', (obj = object) => {
-    const objClone = structuredClone(obj)
+    const objCloned = structuredClone(obj)
   }),
   Benchmark.add('lodash cloneDeep', (obj = object) => {
-    const objClone = _.cloneDeep(obj)
+    const objCloned = _.cloneDeep(obj)
   }),
   Benchmark.add('just-clone', (obj = object) => {
-    const objClone = clone(obj)
+    const objCloned = clone(obj)
   }),
   Benchmark.add('deep-clone', (obj = object) => {
-    const objClone = deepClone(obj)
+    const objCloned = deepClone(obj)
   }),
   Benchmark.cycle(),
   Benchmark.complete(),
@@ -41,6 +42,4 @@ Benchmark.suite(
     format: 'table.html',
     details: true
   })
-).catch(err => {
-  console.error(err)
-})
+).catch(console.error)