norwegian-phone
v1.1.1
Published
Distinguish norwegian landline and mobile phone numbers
Downloads
6
Maintainers
Readme
norwegian-phone
If you need to distinguish norwegian landlines from mobile numbers this library is for you. It is built on the top of the amazing unfold/norwegian-utils utility library.
Installation
This package is distributed via npm:
npm install norwegian-phone
or
yarn add norwegian-phone
Usage
import { isLandline, isMobile } from 'norwegian-phone'
if (isLandline('+4733012345')) {
// yes it is
}
if (isMobile('+4791234567')) {
// yes it is
}
const numbers = [
'+4790123456',
'90123456',
'901 23 456',
'+4733012345',
'33 01 23 45',
'112',
'🐛',
]
const landLines = numbers.filter(isLandline)
// [ '+4733012345', '33 01 23 45' ]
const mobiles = numbers.filter(isMobile)
// [ '+4790123456', '90123456', '901 23 456' ]
Other
This simple library was developed as an exercise while watching amazing egghead course How to Write an Open Source JavaScript Library
Develop
Code, add test and commit with npm run commit
.