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

emergency-numbers

Package Overview
Dependencies
Maintainers
0
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

emergency-numbers

International emergency numbers

  • 1.0.2
  • latest
  • Source
  • npm
  • Socket score

Version published
Maintainers
0
Created
Source

Emergency Numbers

This library provides a convenient way to retrieve emergency contact numbers for different countries. It includes default emergency numbers as well as the ability to retrieve country-specific emergency numbers.

Installation

You can install this library using your preferred package manager:

Package ManagerCommand
npmnpm install emergency-numbers
Yarnyarn add emergency-numbers
pnpmpnpm add emergency-numbers

Choose the appropriate command based on the package manager you have installed in your project. Make sure to run the command in the root directory of your project.

Usage

Importing the Library

import {
  getEmergencyNumberByCountry,
  getEmergencyNumberByCountryAndType,
  getSupportedCountries
} from 'emergency-numbers';

import { NumberType } from 'emergency-numbers/constants';

Retrieving Emergency Numbers

To retrieve the emergency numbers for a specific country, use the getEmergencyNumberByCountry function:

const countryCode = 'US'; // ISO Alpha-2
const emergencyNumbers = getEmergencyNumberByCountry(countryCode);

console.log(emergencyNumbers);
// Output: { fire: 911, police: 911, ambulance: 911 }

To retrieve a specific type of emergency number for a country, use the getEmergencyNumberByCountryAndType function:

const countryCode = 'GB';
const numberType = NumberType.POLICE;
const emergencyNumber = getEmergencyNumberByCountryAndType(countryCode, numberType);

console.log(emergencyNumber);
// Output: 999

Retrieving Supported Countries

To get a list of supported countries for which emergency numbers are available, use the getSupportedCountries function:

const countries = getSupportedCountries();

console.log(countries);
// Output: ['US', 'GB', ...]

Contributing

Contributions are welcome! If you find any issues or have suggestions for improvements, please open an issue or submit a pull request on the GitHub repository.

License

This library is released under the MIT License.

Keywords

FAQs

Package last updated on 22 Nov 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