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.
This package is distributed via npm:
npm install norwegian-phone
or
yarn add norwegian-phone
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' ]
This simple library was developed as an exercise while watching amazing egghead course How to Write an Open Source JavaScript Library
Code, add test and commit with npm run commit
.