We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
There was an error while loading. Please reload this page.
1 parent 33c8647 commit 18be476Copy full SHA for 18be476
benchmark/misc/punycode.js
@@ -1,11 +1,14 @@
1
'use strict';
2
3
const common = require('../common.js');
4
-const icu = process.binding('icu');
+let icu;
5
+try {
6
+ icu = process.binding('icu');
7
+} catch (err) {}
8
const punycode = require('punycode');
9
10
const bench = common.createBenchmark(main, {
- method: ['punycode', 'icu'],
11
+ method: ['punycode'].concat(icu !== undefined ? ['icu'] : []),
12
n: [1024],
13
val: [
14
'افغانستا.icom.museum',
@@ -69,8 +72,11 @@ function main(conf) {
69
72
runPunycode(n, val);
70
73
break;
71
74
case 'icu':
- runICU(n, val);
- break;
75
+ if (icu !== undefined) {
76
+ runICU(n, val);
77
+ break;
78
+ }
79
+ // fallthrough
80
default:
81
throw new Error('Unexpected method');
82
}
0 commit comments