File tree Expand file tree Collapse file tree 2 files changed +25
-1
lines changed
Expand file tree Collapse file tree 2 files changed +25
-1
lines changed Original file line number Diff line number Diff line change 1+ 'use strict';
2+
3+ const common = require('../common.js');
4+
5+ const bench = common.createBenchmark(main, {
6+ n: [1e5],
7+ }, {
8+ flags: ['--expose-internals'],
9+ });
10+
11+ const instances = Array.from({ length: 1000 }).map(() => 'Uint8Array');
12+
13+ function main({ n }) {
14+ const {
15+ codes: {
16+ ERR_INVALID_ARG_TYPE,
17+ },
18+ } = require('internal/errors');
19+ bench.start();
20+ for (let i = 0; i < n; ++i)
21+ new ERR_INVALID_ARG_TYPE('target', instances, 'test');
22+ bench.end(n);
23+ }
Original file line number Diff line number Diff line change @@ -66,7 +66,8 @@ const isWindows = process.platform === 'win32';
6666const messages = new SafeMap();
6767const codes = {};
6868
69- const classRegExp = /^([A-Z][a-z0-9]*)+$/;
69+ const classRegExp = /^[A-Z][a-zA-Z0-9]*$/;
70+
7071// Sorted by a rough estimate on most frequently used entries.
7172const kTypes = [
7273 'string',
You can’t perform that action at this time.
0 commit comments