mirror of
https://github.com/nodejs/node.git
synced 2026-11-27 17:52:27 -05:00
url: use hasIntl instead of try-catch
Like the other internal modules, we should use
`process.binding('config').hasIntl` instead of `try-catch`
to make sure `icu` is bonded or not.
PR-URL: https://github.com/nodejs/node/pull/11571
Reviewed-By: James M Snell <jasnell@gmail.com>
Reviewed-By: Timothy Gu <timothygu99@gmail.com>
Reviewed-By: Colin Ihrig <cjihrig@gmail.com>
Reviewed-By: Luigi Pinca <luigipinca@gmail.com>
Reviewed-By: Anna Henningsen <anna@addaleax.net>
Reviewed-By: Jackson Tian <shyvo1987@gmail.com>
This commit is contained in:
1 parent
f56ca30bf0
commit
24e6fcce8b
1 file changed
+2
-10
+2
-10
@@ -1,15 +1,7 @@
|
||||
'use strict';
|
||||
|
||||
function importPunycode() {
|
||||
try {
|
||||
return process.binding('icu');
|
||||
} catch (e) {
|
||||
return require('punycode');
|
||||
}
|
||||
}
|
||||
|
||||
const { toASCII } = importPunycode();
|
||||
|
||||
const { toASCII } = process.binding('config').hasIntl ?
|
||||
process.binding('icu') : require('punycode');
|
||||
const { StorageObject, hexTable } = require('internal/querystring');
|
||||
const internalUrl = require('internal/url');
|
||||
exports.parse = urlParse;
|
||||
|
||||
Reference in new issue
Block a user