| FazBrowse GitHub Viewer | Trending | | Home |
| Tools: [Download Repo ZIP] [Original HTTPS Page] |
1 parent 2146c88 commit f8063d5
1 file changed
| Original file line number | Diff line number | Diff line change | |
|---|---|---|---|
@@ -1,11 +1,14 @@ | |||
| 1 | 1 | 'use strict'; | |
| 2 | 2 | ||
| 3 | 3 | const common = require('../common.js'); | |
| 4 | - const icu = process.binding('icu'); | ||
| 4 | + let icu; | ||
| 5 | + try { | ||
| 6 | + icu = process.binding('icu'); | ||
| 7 | + } catch (err) {} | ||
| 5 | 8 | const punycode = require('punycode'); | |
| 6 | 9 | ||
| 7 | 10 | const bench = common.createBenchmark(main, { | |
| 8 | - method: ['punycode', 'icu'], | ||
| 11 | + method: ['punycode'].concat(icu !== undefined ? ['icu'] : []), | ||
| 9 | 12 | n: [1024], | |
| 10 | 13 | val: [ | |
| 11 | 14 | 'افغانستا.icom.museum', | |
@@ -69,8 +72,11 @@ function main(conf) { | |||
| 69 | 72 | runPunycode(n, val); | |
| 70 | 73 | break; | |
| 71 | 74 | case 'icu': | |
| 72 | - runICU(n, val); | ||
| 73 | - break; | ||
| 75 | + if (icu !== undefined) { | ||
| 76 | + runICU(n, val); | ||
| 77 | + break; | ||
| 78 | + } | ||
| 79 | + // fallthrough | ||
| 74 | 80 | default: | |
| 75 | 81 | throw new Error('Unexpected method'); | |
| 76 | 82 | } | |
| Back | FazBrowse Home | New Git URL |
0 commit comments