Phone-formatter is a minimal Node.js library (v0.0.2, last updated 2013) for normalizing and formatting US-centric telephone numbers. It provides two methods: normalize() strips non-digits and leading country codes, returning 10 digits; format() renders a 10-digit string into arbitrary formats using 'N' placeholders. The library is simple but unmaintained, lacks international support, and has no TypeScript types, testing, or active development. It is suitable for legacy projects only.
npm install phone-formatterNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates normalize, format, and combined usage with options object.
Migrate to a maintained alternative like google-libphonenumber.
Do not use for international numbers; only US numbers are reliably handled.
Ensure input has exactly 10 numeric characters before formatting.
Install @types/phone-formatter if available (none published) or declare module manually.
Use const phoneFormatter = require('phone-formatter'); instead of import.Ensure you are using require('phone-formatter') in a CommonJS context.Use normalize first, then check length; if 11 digits, slice(1) to remove country code.
No dependency data recorded yet.