Benchmark.add('Reflect keys', (obj = testObject) => {
return Reflect.ownKeys(obj).length === 0 && obj?.constructor === Object
}),
- Benchmark.add('Keys iteration ', (obj = testObject) => {
+ Benchmark.add('Keys iteration', (obj = testObject) => {
if (obj?.constructor !== Object) return false
// Iterates over the keys of an object, if
// any exist, return false.
--- /dev/null
+const Benchmark = require('benny')
+
+Benchmark.suite(
+ 'Is undefined',
+ Benchmark.add('=== undefined', (value = undefined) => {
+ return value === undefined
+ }),
+ Benchmark.add("typeof === 'undefined'", (value = undefined) => {
+ return typeof value === 'undefined'
+ }),
+ Benchmark.cycle(),
+ Benchmark.complete(),
+ Benchmark.save({
+ file: 'is-undefined',
+ format: 'json',
+ details: true
+ }),
+ Benchmark.save({
+ file: 'is-undefined',
+ format: 'chart.html',
+ details: true
+ }),
+ Benchmark.save({
+ file: 'is-undefined',
+ format: 'table.html',
+ details: true
+ })
+)
"benchmark:busy-wait": "node busy-wait.js",
"benchmark:empty-array": "node empty-array.js",
"benchmark:is-empty-object": "node is-empty-object.js",
+ "benchmark:is-undefined": "node is-undefined.js",
"benchmark:quick-select": "node quick-select.js",
"benchmark:max": "node max.js",
"benchmark:promise-handling": "node promise-handling.js",