Package Exports
- phone-fns
This package does not declare an exports field, so the exports above have been automatically detected and optimized by JSPM instead. If any package subpath is missing, it is recommended to post an issue to the original package (phone-fns) to support the "exports" field. If that is not possible, create a JSPM override to customize the exports field for this package.
Readme
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
<!-- It is recommended to replace the @latest with a strict version number for production -->
<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')
// => { areaCode: '444', localCode: '333', lineNumber: '2222', extension: '' }
phoneFns.format('(NNN) NNN-NNNN', '4443332222')
// => '(444) 333-2222'You can also destructure to only use the functions you want
import { breakdown, format } from 'phone-fns'
breakdown('4443332222')
// => { areaCode: '444', localCode: '333', lineNumber: '2222', extension: '' }
format('(NNN) NNN-NNNN', '4443332222')
// => '(444) 333-2222'