Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

timezone-phone-codes

Package Overview
Dependencies
Maintainers
0
Versions
2
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

timezone-phone-codes

A simple library to return telephone codes based on timezone

  • 0.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
3.4K
increased by2.68%
Maintainers
0
Weekly downloads
 
Created
Source

Timezone Phone Codes

A lightweight, easy-to-use library for retrieving telephone country codes based on timezone, with full TypeScript support.

Features

  • Get phone country codes by timezone
  • Zero dependencies

Installation

You can install this package using npm, yarn, or pnpm:

# npm
npm install timezone-phone-codes

# yarn
yarn add timezone-phone-codes

# pnpm
pnpm add timezone-phone-codes

Usage

Here's a basic example of how to use the library:

import { getPhoneCodeByTimezone } from 'timezone-phone-codes';

const phoneCode = getPhoneCodeByTimezone('America/New_York');
console.log(phoneCode); // Output: +1

const unknownTimezone = getPhoneCodeByTimezone('Unknown/Timezone');
console.log(unknownTimezone); // Output: null

API

getPhoneCodeByTimezone(timezone: string): string | null

Returns the phone country code for the given timezone. If the timezone is not recognized, it returns null.

Supported Timezones

This library supports a wide range of timezones. Here are a few examples:

  • America/New_York: +1
  • Europe/London: +44
  • Asia/Tokyo: +81
  • Australia/Sydney: +61

Testing

To run the tests:

pnpm test

To run the tests with coverage:

pnpm coverage

Keywords

FAQs

Package last updated on 23 Sep 2024

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