summaryrefslogtreecommitdiff
path: root/ext/node/polyfills/punycode.ts
diff options
context:
space:
mode:
authorLeo Kettmeir <crowlkats@toaxl.com>2023-02-20 18:47:42 +0100
committerGitHub <noreply@github.com>2023-02-20 18:47:42 +0100
commit88f6fc6a1684326ae1f947ea8ec24ad0bff0f449 (patch)
tree0fa821ef0ff1ff5120ce43bf0d6052767d1f792b /ext/node/polyfills/punycode.ts
parentea7ca00c895c401af57a7201f3c41524333e7939 (diff)
refactor: use ops for idna & punycode (#17817)
Towards https://github.com/denoland/deno/issues/17809
Diffstat (limited to 'ext/node/polyfills/punycode.ts')
-rw-r--r--ext/node/polyfills/punycode.ts26
1 files changed, 19 insertions, 7 deletions
diff --git a/ext/node/polyfills/punycode.ts b/ext/node/polyfills/punycode.ts
index f58871c0a..30fb727c2 100644
--- a/ext/node/polyfills/punycode.ts
+++ b/ext/node/polyfills/punycode.ts
@@ -1,12 +1,24 @@
// Copyright 2018-2023 the Deno authors. All rights reserved. MIT license.
-import {
- decode,
- encode,
- toASCII,
- toUnicode,
- ucs2,
-} from "internal:deno_node/polyfills/internal/idna.ts";
+import { ucs2 } from "internal:deno_node/polyfills/internal/idna.ts";
+
+const { ops } = globalThis.__bootstrap.core;
+
+function toASCII(domain) {
+ return ops.op_node_idna_domain_to_ascii(domain);
+}
+
+function toUnicode(domain) {
+ return ops.op_node_idna_domain_to_unicode(domain);
+}
+
+function decode(domain) {
+ return ops.op_node_idna_punycode_decode(domain);
+}
+
+function encode(domain) {
+ return ops.op_node_idna_punycode_encode(domain);
+}
export { decode, encode, toASCII, toUnicode, ucs2 };