| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -0,0 +1,23 @@ | |||
| 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'; | |||
| 66 | 66 | const messages = new SafeMap(); | |
| 67 | 67 | const codes = {}; | |
| 68 | 68 | ||
| 69 | - const classRegExp = /^([A-Z][a-z0-9]*)+$/; | ||
| 69 | + const classRegExp = /^[A-Z][a-zA-Z0-9]*$/; | ||
| 70 | + | ||
| 70 | 71 | // Sorted by a rough estimate on most frequently used entries. | |
| 71 | 72 | const kTypes = [ | |
| 72 | 73 | 'string', | |
| Back | FazBrowse Home | New Git URL |
0 commit comments