Socket
Socket
Sign inDemoInstall

@zene/mobile-number-validator

Package Overview
Dependencies
0
Maintainers
2
Versions
15
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    @zene/mobile-number-validator

A lightweight Javascript library for retrieving country information, including country codes, based on provided data. Simplify your application's logic by seamlessly integrating with this package to extract essential country details, facilitating tasks su


Version published
Weekly downloads
75
decreased by-39.52%
Maintainers
2
Install size
283 kB
Created
Weekly downloads
 

Readme

Source

Mobile Number Validation Library

This npm library provides country data validation functionality, allowing you to retrieve data related to phone number lengths by country code.

Installation

You can install the library via npm:

  npm install my-country-data-library

Usage

// Vanilla JS
const { getCountryDataByCode } = require('my-country-data-library');

// React usage
import { getCountryDataByCode } from '@zene/mobile-number-validator';

// Example usage:
    const params = {
        countryCode: string,
        mobileNumber?: string,
        internationalValidation?: boolean
    }
    const countryData = getCountryDataByCode(params);
    console.log(countryData);
{
  IsError: bool,
  Message: 'string',
  ReturnObj: {
    country: 'string',
    phLengthMax: int,
    phLengthMin: int,
    phExample: 'string',
    validNumber?: 'string'
  }
}

API Reference

getCountryDataByCode
getCountryDataByCode({ countryCode: string|number, mobileNumber?: string,    }): NumberValidationData
ParameterTypeDescription
countryCodenumber or stringRequired. The numeric country code for the desired country
mobileNumberstringMobile number that needs to be verify
internationalValidationbooleanallows for an international dialing code to be in the number
NumberValidationData Interface
{
    country: string;
    phLengthMax: number |null;
    phLengthMin: number | null;
    phExample?: string | number;
    validNumber?: string | null;
}

License

MIT

Keywords

FAQs

Last updated on 03 Apr 2024

Did you know?

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc