mirror of
https://github.com/nodejs/node.git
synced 2024-11-30 15:30:56 +01:00
d4061a6314
ESLint 3.5.0 introduces a `no-restricted-properties` rule. Replace our custom `no-deepEqual` rule with this rule. PR-URL: https://github.com/nodejs/node/pull/8478 Reviewed-By: James M Snell <jasnell@gmail.com>
42 lines
836 B
JavaScript
42 lines
836 B
JavaScript
'use strict';
|
|
var common = require('../common.js');
|
|
var assert = require('assert');
|
|
|
|
const primValues = {
|
|
'null': null,
|
|
'undefined': undefined,
|
|
'string': 'a',
|
|
'number': 1,
|
|
'boolean': true,
|
|
'object': { 0: 'a' },
|
|
'array': [1, 2, 3],
|
|
'new-array': new Array([1, 2, 3])
|
|
};
|
|
|
|
var bench = common.createBenchmark(main, {
|
|
prim: Object.keys(primValues),
|
|
n: [25]
|
|
});
|
|
|
|
function main(conf) {
|
|
var prim = primValues[conf.prim];
|
|
var n = +conf.n;
|
|
var primArray;
|
|
var primArrayCompare;
|
|
var x;
|
|
|
|
primArray = new Array();
|
|
primArrayCompare = new Array();
|
|
for (x = 0; x < (1e5); x++) {
|
|
primArray.push(prim);
|
|
primArrayCompare.push(prim);
|
|
}
|
|
|
|
bench.start();
|
|
for (x = 0; x < n; x++) {
|
|
// eslint-disable-next-line no-restricted-properties
|
|
assert.deepEqual(primArray, primArrayCompare);
|
|
}
|
|
bench.end(n);
|
|
}
|