Skip to content

Quick start

Terminal window
npm install @telixon/core

Load the engine once, then parse:

import { ensureEngineReady, parsePhoneNumber } from '@telixon/core';
await ensureEngineReady();
const number = parsePhoneNumber('+14155550132');
number.isValid(); // true
number.getNumberType(); // "MOBILE"
number.formatInternational(); // "+1 415-555-0132"

Add @telixon/web-sdk for a DOM-bound input controller:

Terminal window
npm install @telixon/core @telixon/web-sdk
import { ensureEngineReady } from '@telixon/core';
import { createPhoneInput } from '@telixon/web-sdk';
await ensureEngineReady();
const phone = createPhoneInput({
input: document.querySelector('#phone'),
mode: 'international',
});
phone.subscribe((state) => {
// state.value, state.region, state.validationError, ...
});