Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/seanghay/network-operators

📞 A package for querying network operators in Cambodia.
https://github.com/seanghay/network-operators

cambodia cellcard khmer metfone network smart telecommunications

Last synced: about 2 months ago
JSON representation

📞 A package for querying network operators in Cambodia.

Awesome Lists containing this project

README

        

# 📞 Network Operators

A package for querying network operators in Cambodia.

[![test](https://github.com/seanghay/network-operators/actions/workflows/test.yml/badge.svg)](https://github.com/seanghay/network-operators/actions/workflows/test.yml)
[![npm](https://img.shields.io/npm/v/network-operators)](https://npmjs.com/package/network-operators)

## Install

npm

```
npm install network-operators
```

pnpm

```
pnpm add network-operators
```

yarn
```
yarn add network-operators
```

## Usage

```js
// ESM
import {
prefixInfo,
phoneNumberInfo,
networkOperators,
parsePhoneNumber
} from 'network-operators'

// CJS
const {
prefixInfo,
phoneNumberInfo,
networkOperators,
parsePhoneNumber
} = require('network-operators')

console.log(prefixInfo('012'))
// { operator: 'Cellcard', length: [ 6, 7 ] }

console.log(phoneNumberInfo('012123123'))
// {
// operator: 'Cellcard',
// length: [ 6, 7 ],
// prefix: '012',
// suffix: '123123',
// number: '012123123'
// }

console.log(networkOperators())
// [
// 'Cellcard', 'CooTel',
// 'Kingtel', 'Seatel',
// 'Metfone', 'qb',
// 'Smart'
// ]

console.log(parsePhoneNumber('010123123'))
// { prefix: '010', suffix: '123123', number: '010123123' }
```

## Free Public API runs on deno.dev

```
https://network.deno.dev/010
https://network.deno.dev/096
https://network.deno.dev/086
https://network.deno.dev/012888999
```

## License

Apache-2.0

## References

[Telephone numbers in Cambodia](https://en.wikipedia.org/wiki/Telephone_numbers_in_Cambodia)