Socket
Socket
Sign inDemoInstall

@types/punycode

Package Overview
Dependencies
Maintainers
1
Versions
5
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

@types/punycode

TypeScript definitions for punycode


Version published
Maintainers
1
Created

What is @types/punycode?

@types/punycode provides TypeScript type definitions for the punycode library, which is used for encoding and decoding Unicode strings to and from the ASCII-compatible Punycode representation. This is particularly useful for handling internationalized domain names (IDNs).

What are @types/punycode's main functionalities?

Encode a Unicode string to Punycode

This feature allows you to encode a Unicode string into its Punycode representation. This is useful for converting internationalized domain names to a format that can be used in DNS queries.

const punycode = require('punycode');
const input = 'mañana';
const output = punycode.encode(input);
console.log(output); // 'maana-pta'

Decode a Punycode string to Unicode

This feature allows you to decode a Punycode string back into its original Unicode representation. This is useful for converting Punycode domain names back to their readable form.

const punycode = require('punycode');
const input = 'maana-pta';
const output = punycode.decode(input);
console.log(output); // 'mañana'

Convert a domain name to ASCII

This feature converts a Unicode domain name to its ASCII-compatible Punycode representation. This is useful for preparing internationalized domain names for DNS resolution.

const punycode = require('punycode');
const input = 'mañana.com';
const output = punycode.toASCII(input);
console.log(output); // 'xn--maana-pta.com'

Convert a domain name to Unicode

This feature converts a Punycode domain name back to its Unicode representation. This is useful for displaying internationalized domain names in a readable format.

const punycode = require('punycode');
const input = 'xn--maana-pta.com';
const output = punycode.toUnicode(input);
console.log(output); // 'mañana.com'

Other packages similar to @types/punycode

FAQs

Package last updated on 18 Oct 2023

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc