A JavaScript telephone number formatting library based on Google's libphonenumber and compiled via Google Closure. Version 1.0.9 is the latest, last synced with libphonenumber v8.10.6. Provides formatting (E164, international, local), validation, country code lookup, and examples. Note: it may lag behind the latest libphonenumber; users can manually update the source via the Closure compiler. Provides AMD, CommonJS, and global builds. Lightweight alternative to libphonenumber-js or google-libphonenumber.
npm install phoneformat.jsNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Demonstrates importing phoneFormat.js and using its key functions: validation, E164/international/local formatting, mobile dialing, and cleaning.
Manually update source via Closure compiler per README or switch to actively maintained library like libphonenumber-js or google-libphonenumber.
Use default import: import phoneFormat from 'phoneformat.js'; then access methods as properties.
Use const phoneFormat = require('phoneformat.js'); not require(...).default.Always provide country codes in uppercase (e.g., 'US' not 'us').
Change import statement to: import phoneFormat from 'phoneformat.js'; then use phoneFormat.isValidNumber().
Use the global build (phone-format-global.js) instead of the CommonJS one.
Ensure the phone number is in E164 format (e.g., +14155552671) and valid.
No dependency data recorded yet.