From c4e2bbbcab631a159b62d2e8abed152a75fdd0c5 Mon Sep 17 00:00:00 2001 From: Rich Trott Date: Thu, 31 Jan 2019 21:05:17 -0800 Subject: [PATCH] benchmark: use consistent coding style in assert/* Files in benchmark/assert/* were sometimes using trailing commas for multi-line objects and sometimes not, mixing the approaches in the same file sometimes. Standardize these files to always use trailing commas in multi-line objects. Additionally, remove some unnecessary line-wrapping (so that there are fewer multi-line objects). PR-URL: https://github.com/nodejs/node/pull/25865 Reviewed-By: Richard Lau Reviewed-By: Vse Mozhet Byt --- benchmark/assert/deepequal-buffer.js | 5 +---- benchmark/assert/deepequal-map.js | 4 ++-- benchmark/assert/deepequal-object.js | 9 +++------ .../assert/deepequal-prims-and-objs-big-array-set.js | 6 +++--- benchmark/assert/deepequal-prims-and-objs-big-loop.js | 7 ++----- benchmark/assert/deepequal-set.js | 4 ++-- benchmark/assert/deepequal-typedarrays.js | 2 +- benchmark/assert/ok.js | 4 +--- benchmark/assert/throws.js | 6 +----- 9 files changed, 16 insertions(+), 31 deletions(-) diff --git a/benchmark/assert/deepequal-buffer.js b/benchmark/assert/deepequal-buffer.js index baf3e1766c15f5..b8d7529ebc3291 100644 --- a/benchmark/assert/deepequal-buffer.js +++ b/benchmark/assert/deepequal-buffer.js @@ -6,10 +6,7 @@ const bench = common.createBenchmark(main, { n: [2e4], len: [1e2, 1e3], strict: [0, 1], - method: [ - 'deepEqual', - 'notDeepEqual' - ] + method: [ 'deepEqual', 'notDeepEqual' ], }); function main({ len, n, method, strict }) { diff --git a/benchmark/assert/deepequal-map.js b/benchmark/assert/deepequal-map.js index c15e1c9a360c3b..ea1b73cec0e522 100644 --- a/benchmark/assert/deepequal-map.js +++ b/benchmark/assert/deepequal-map.js @@ -14,8 +14,8 @@ const bench = common.createBenchmark(main, { 'deepEqual_mixed', 'notDeepEqual_primitiveOnly', 'notDeepEqual_objectOnly', - 'notDeepEqual_mixed' - ] + 'notDeepEqual_mixed', + ], }); function benchmark(method, n, values, values2) { diff --git a/benchmark/assert/deepequal-object.js b/benchmark/assert/deepequal-object.js index 1a9c826a00d4c1..240da23d244039 100644 --- a/benchmark/assert/deepequal-object.js +++ b/benchmark/assert/deepequal-object.js @@ -7,10 +7,7 @@ const bench = common.createBenchmark(main, { n: [5e3], size: [1e2, 1e3, 5e4], strict: [0, 1], - method: [ - 'deepEqual', - 'notDeepEqual' - ] + method: [ 'deepEqual', 'notDeepEqual' ], }); function createObj(source, add = '') { @@ -21,8 +18,8 @@ function createObj(source, add = '') { a: [1, 2, 3], baz: n, c: {}, - b: [] - } + b: [], + }, })); } diff --git a/benchmark/assert/deepequal-prims-and-objs-big-array-set.js b/benchmark/assert/deepequal-prims-and-objs-big-array-set.js index 71637c28cea999..981ec3f0e90fac 100644 --- a/benchmark/assert/deepequal-prims-and-objs-big-array-set.js +++ b/benchmark/assert/deepequal-prims-and-objs-big-array-set.js @@ -8,7 +8,7 @@ const primValues = { 'string': 'a', 'number': 1, 'object': { 0: 'a' }, - 'array': [1, 2, 3] + 'array': [1, 2, 3], }; const bench = common.createBenchmark(main, { @@ -20,8 +20,8 @@ const bench = common.createBenchmark(main, { 'deepEqual_Array', 'notDeepEqual_Array', 'deepEqual_Set', - 'notDeepEqual_Set' - ] + 'notDeepEqual_Set', + ], }); function run(fn, n, actual, expected) { diff --git a/benchmark/assert/deepequal-prims-and-objs-big-loop.js b/benchmark/assert/deepequal-prims-and-objs-big-loop.js index 13abaf107fdfb9..00b3c785a4dc71 100644 --- a/benchmark/assert/deepequal-prims-and-objs-big-loop.js +++ b/benchmark/assert/deepequal-prims-and-objs-big-loop.js @@ -6,17 +6,14 @@ const primValues = { 'string': 'a', 'number': 1, 'object': { 0: 'a' }, - 'array': [1, 2, 3] + 'array': [1, 2, 3], }; const bench = common.createBenchmark(main, { primitive: Object.keys(primValues), n: [2e4], strict: [0, 1], - method: [ - 'deepEqual', - 'notDeepEqual', - ] + method: [ 'deepEqual', 'notDeepEqual' ], }); function main({ n, primitive, method, strict }) { diff --git a/benchmark/assert/deepequal-set.js b/benchmark/assert/deepequal-set.js index 1f4061afb2a300..b4406b2600f2b1 100644 --- a/benchmark/assert/deepequal-set.js +++ b/benchmark/assert/deepequal-set.js @@ -14,8 +14,8 @@ const bench = common.createBenchmark(main, { 'deepEqual_mixed', 'notDeepEqual_primitiveOnly', 'notDeepEqual_objectOnly', - 'notDeepEqual_mixed' - ] + 'notDeepEqual_mixed', + ], }); function benchmark(method, n, values, values2) { diff --git a/benchmark/assert/deepequal-typedarrays.js b/benchmark/assert/deepequal-typedarrays.js index 9f9c68a6731254..9acf83711efb0d 100644 --- a/benchmark/assert/deepequal-typedarrays.js +++ b/benchmark/assert/deepequal-typedarrays.js @@ -16,7 +16,7 @@ const bench = common.createBenchmark(main, { 'deepEqual', 'notDeepEqual', ], - len: [1e2, 5e3] + len: [1e2, 5e3], }); function main({ type, n, len, method, strict }) { diff --git a/benchmark/assert/ok.js b/benchmark/assert/ok.js index 4869a9de69c319..c50c0e069f42cf 100644 --- a/benchmark/assert/ok.js +++ b/benchmark/assert/ok.js @@ -3,9 +3,7 @@ const common = require('../common.js'); const assert = require('assert'); -const bench = common.createBenchmark(main, { - n: [1e5] -}); +const bench = common.createBenchmark(main, { n: [1e5] }); function main({ n }) { var i; diff --git a/benchmark/assert/throws.js b/benchmark/assert/throws.js index 1788630cb2f992..3a6326371dc872 100644 --- a/benchmark/assert/throws.js +++ b/benchmark/assert/throws.js @@ -5,11 +5,7 @@ const { throws, doesNotThrow } = require('assert'); const bench = common.createBenchmark(main, { n: [1e4], - method: [ - 'doesNotThrow', - 'throws_TypeError', - 'throws_RegExp' - ] + method: [ 'doesNotThrow', 'throws_TypeError', 'throws_RegExp' ], }); function main({ n, method }) {