Phone Fns
A small modern, and functional phone number library which gathers inspiration from the fun date-fns library
How-To
npm i phone-fns
Standard module system
import phoneFns from 'phone-fns'
Common JS
const phoneFns = require('phone-fns')
CDN
<script src="https://cdn.jsdelivr.net/npm/phone-fns@latest/dist/phone-fns.min.js"></script>
Through the browser
<script src="path/to/location/dist/phone-fns.min.js"></script>
Usage
import phoneFns from 'phone-fns'
phoneFns.breakdown('4443332222')
phoneFns.format('(NNN) NNN-NNNN', '4443332222')
You can also destructure to only use the functions you want
import { breakdown, format } from 'phone-fns'
breakdown('4443332222')
format('(NNN) NNN-NNNN', '4443332222')