1.0.9 • Published 1 year ago

@zene/mobile-number-validator v1.0.9

Weekly downloads
-
License
MIT
Repository
github
Last release
1 year ago

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

1.0.9

1 year ago

1.0.8

1 year ago

1.0.7

1 year ago

1.0.6

1 year ago

1.0.5

1 year ago

1.0.4

1 year ago

1.0.3

1 year ago

1.0.2

1 year ago

1.0.1

1 year ago

1.0.0

1 year ago

0.0.5

1 year ago

0.0.4

1 year ago

0.0.3

1 year ago

0.0.2

1 year ago

0.0.1

1 year ago