norwegian-phone
TypeScript icon, indicating that this package has built-in type declarations

1.1.1 • Public • Published

travis build codecov coverage version downloads MIT License semantic-release

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.

Package Sidebar

Install

npm i norwegian-phone

Weekly Downloads

1

Version

1.1.1

License

MIT

Unpacked Size

5.81 kB

Total Files

4

Last publish

Collaborators

  • robert.sasak