npm.io
1.0.13 • Published 5 years ago

french-phone-api

Licence
MIT
Version
1.0.13
Deps
4
Size
9 kB
Vulns
1
Weekly
0

FRENCH PHONE API

This small JavaScript library returns information about any French phone numbers from this website in a JSON format.

Build Status

It works with FRENCH phone numbers ONLY.

Installation

yarn add french-phone-api

or

npm i french-phone-api --save

Use

With JavaScript

var F = require('french-phone-api')
new F.FrenchPhoneInfoGetter('0782301616')
	.getInformation()
	.then((result)=>{
		console.log(result)
	})
	.catch(err=>{
		console.log(err)
	})

Or with TypeScript

import {FrenchPhoneInfoGetter} from  'french-phone-api'

try {
	const  result  =  await  new  FrenchPhoneInfoGetter('0782301615').getInformation()
	console.log(result)
} catch (error) {
	console.log(error)
}

Response

{
	input: '0778453625',
   	formatted: '+33778453625',
	isMobile: true,
	danger: 0,
	operator: 'free'
}

Test

To run tests

yarn run test

or

npm run test

Keywords