
Research
/Security News
9 Malicious NuGet Packages Deliver Time-Delayed Destructive Payloads
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.
phone-number-formats
Advanced tools
Easy way to format and convert phone numbers now with method chaining and custom types
$ npm install phone-number-formats
const phoneNumberFormatter = require('phone-number-formats');
let home = new phoneNumberFormatter('1234567').format();
// 123-4567
let work = new phoneNumberFormatter('3-141-592-6535').format({type: 'domestic'});
// (141) 592-6535
let boss = new phoneNumberFormatter('18008675309').format({type: 'international', separator: '.'});
// +1.800.867.5309
let drew = new phoneNumberFormatter('+1 (800) 271-WHAT').format({type: 'international', areaCode: '996'}).convert();
// +996 (800) 271-8281
Format the number to local, domestic, international, or a custom type
let number = new phoneNumberFormatter('18001234567');
number.format({type: 'international', areaCode: '996', separator: '.', letters: true});
// +996.(800).123.4567
Convert any letters to numbers
let number = new phoneNumberFormatter('123WHAT');
number.convert();
// 1239428
Get phone number as a string
Add new type to be used in format method
// The X's signify numbers and the Y's signify the area code by default
phoneNumberFormatter.addType('china', '0 +YYY XXX-XXX');
number = new phoneNumberFormatter('314159').format({type: 'china', areaCode: '591'});
// 0 +591 314-159
// Different letters or symbols can be used as delimiters
phoneNumberFormatter.addType('x-ray', '(VVV) WWW-XRAY', {number: 'W', areaCode: 'V'});
number = new phoneNumberFormatter('314159').format({type: 'x-ray'});
// (314) 159-XRAY
Gets the key for any default or custom type
phoneNumberFormatter.getType('china');
// 0 +YYY XXX-XXX
See test.js for examples
FAQs
Format phone numbers
The npm package phone-number-formats receives a total of 436 weekly downloads. As such, phone-number-formats popularity was classified as not popular.
We found that phone-number-formats demonstrated a not healthy version release cadence and project activity because the last version was released 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.

Research
/Security News
Socket researchers discovered nine malicious NuGet packages that use time-delayed payloads to crash applications and corrupt industrial control systems.

Security News
Socket CTO Ahmad Nassri discusses why supply chain attacks now target developer machines and what AI means for the future of enterprise security.

Security News
Learn the essential steps every developer should take to stay secure on npm and reduce exposure to supply chain attacks.