Code Monkey home page Code Monkey logo

phone-ext's Introduction

Phonext

A simple library to get country phone codes and related information. This package allows you to find country information based on their name, dial code, or ISO country code.

Installation

npm install phonext

Usage


const {
  countryCodes,
  findByCode,
  findByName,
  findByDialCode
} = require('phonext');

// Get the full list of country phone codes
console.log(countryCodes);

// Find country information by ISO country code
console.log(findByCode('US'));

// Find country information by name
console.log(findByName('United States'));

// Find country information by dial code
console.log(findByDialCode('+1'));

API

An array of country objects containing name, dial_code, and code properties.

findByCode(code)

Finds a country object by its ISO country code.

  • code (String): The ISO country code, e.g., 'US'.

findByName(name)

Finds a country object by its name.

  • name (String): The country name, e.g., 'United States'.

findByDialCode(dialCode)

Finds a country object by its dial code.

  • dialCode (String): The country dial code, e.g., '+1'.

License

Pylar AI creative ML License 0.0.4

Copyright (c) 2023 Miguel Gargallo

Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to use the Software solely for non-commercial purposes and to show the code or result for scientific purposes. Any commercial use, including without limitation the rights to sell, copy, modify, merge, publish, distribute, sublicense, or use the Software as part of a commercial product, is strictly prohibited.

The above copyright notice and this permission notice shall be included in all copies or substantial portions of the Software.

THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS FOR A PARTICULAR PURPOSE, AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES, OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT, OR OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE.

phone-ext's People

Contributors

miguelgargallo avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.