Security News
The Push to Ban Ransom Payments Is Gaining Momentum
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
phone-fns
Advanced tools
Changelog
v3.0.0
find
function since it was rather pointlessmatch
function since it was rather pointlessC + (NNN) NNN-NNNN
format('C + (NNN) NNN-NNNN', 14445556666) // => '1 + (444) 555-6666'
breakdown
no longer handles or accepts country codes
format
function this is to make functions easier to useuglify-js
with terser
for performance gainsisValid
optimizations using KyaniteReadme
A small modern, and functional phone number library which gathers inspiration from the fun date-fns library
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>
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'
FAQs
A small, modern, and functional phone library for javascript
We found that phone-fns demonstrated a healthy version release cadence and project activity because the last version was released less than a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.
Security News
Ransomware costs victims an estimated $30 billion per year and has gotten so out of control that global support for banning payments is gaining momentum.
Application Security
New SEC disclosure rules aim to enforce timely cyber incident reporting, but fear of job loss and inadequate resources lead to significant underreporting.
Security News
The Python Software Foundation has secured a 5-year sponsorship from Fastly that supports PSF's activities and events, most notably the security and reliability of the Python Package Index (PyPI).