A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://github.com/mr-tolmach/raf below:

mr-tolmach/raf: Open-source library for generating valid phone numbers in the E.164 format based on upgraded metadata from libphonenumber

Open-source library for generating valid phone numbers in the E.164 format based on upgraded metadata from libphonenumber

Why not just use the libphonenumber?

There are several reasons for this:

First, find out which version is needed by looking at VERSIONS.md.

‼️ The version of libphonenumber in your project SHOULD BE EQUAL to the version of libphonenumber in the raf library. Otherwise there is no guarantee that the generated phones will be correctly parsed by libphonenumber. Be very careful here! ‼️

Then, add the following dependency:

// rafVersion is the version that you found in the previous step
"io.github.mr-tolmach" %% "raf-generators" % rafVersion

Finally, use it in your code:

import io.github.mr_tolmach.generators.E164Generators
import io.github.mr_tolmach.metadata.model.Regions
import io.github.mr_tolmach.metadata.model.PhoneNumberTypes

// for scalatest + scalacheck property-based testing
forAll(E164Generators.phoneNumberGen(Regions.AW))(check)

// to generate valid phone numbers for the AC region with any type of phone number
E164Generators.phoneNumberGen(Regions.AC).sample

// to generate valid fixed-line phone numbers for the US region
E164Generators.phoneNumberGen(Regions.US, PhoneNumberTypes.FixedLine).sample

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4