{"_id":"@birtalanrobert/phone","name":"@birtalanrobert/phone","dist-tags":{"latest":"1.0.0"},"versions":{"1.0.0":{"name":"@birtalanrobert/phone","version":"1.0.0","description":"Telephone numbers as a durable customer identity: matching, formatting and dialling","license":"AGPL-3.0-only","type":"commonjs","main":"./dist/index.js","types":"./dist/index.d.ts","exports":{".":{"types":"./dist/index.d.ts","default":"./dist/index.js"},"./package.json":"./package.json"},"publishConfig":{"access":"public"},"repository":{"type":"git","url":"git+https://github.com/birtalanrobert/mortar.git","directory":"packages/phone"},"scripts":{"build":"tsc -p tsconfig.build.json","clean":"rm -rf dist *.tsbuildinfo","typecheck":"tsc -p tsconfig.json"},"_id":"@birtalanrobert/phone@1.0.0","bugs":{"url":"https://github.com/birtalanrobert/mortar/issues"},"homepage":"https://github.com/birtalanrobert/mortar#readme","_integrity":"sha512-5IO/En8zviJavXRJn8M0/hfmbo4htabL5kkghyowrdQzRK4tLtKj9kN4wyNz7j4HHGAB+b7VZnbdShz2wNCKKw==","_resolved":"/private/var/folders/zx/7dcyg3mn6kjfyzsymzgpx1jr0000gn/T/ce148923339fc0f823acf215649ed843/birtalanrobert-phone-1.0.0.tgz","_from":"file:birtalanrobert-phone-1.0.0.tgz","_nodeVersion":"24.16.0","_npmVersion":"11.13.0","dist":{"integrity":"sha512-5IO/En8zviJavXRJn8M0/hfmbo4htabL5kkghyowrdQzRK4tLtKj9kN4wyNz7j4HHGAB+b7VZnbdShz2wNCKKw==","shasum":"19cadacd0cbda35943f9702b645a3cddca89b59a","tarball":"https://registry.npmjs.org/@birtalanrobert/phone/-/phone-1.0.0.tgz","fileCount":15,"unpackedSize":91784,"signatures":[{"keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U","sig":"MEUCIQC7npSAtxqxyWXZOvESxgNagxJgsO3JWT3Q+tb1f2GDXQIgBeGzX6gZSjFBPoT4y2Tf1fHFpXmse1pNBvqsldfojoY="}]},"_npmUser":{"name":"birtalanrobert","email":"birtalanrobert@gmail.com"},"directories":{},"maintainers":[{"name":"birtalanrobert","email":"birtalanrobert@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/phone_1.0.0_1788557003160_0.7675940105574484"},"_hasShrinkwrap":false}},"time":{"created":"2026-09-04T21:23:23.003Z","1.0.0":"2026-09-04T21:23:23.303Z","modified":"2026-09-04T21:23:23.582Z"},"maintainers":[{"name":"birtalanrobert","email":"birtalanrobert@gmail.com"}],"description":"Telephone numbers as a durable customer identity: matching, formatting and dialling","homepage":"https://github.com/birtalanrobert/mortar#readme","repository":{"type":"git","url":"git+https://github.com/birtalanrobert/mortar.git","directory":"packages/phone"},"bugs":{"url":"https://github.com/birtalanrobert/mortar/issues"},"license":"AGPL-3.0-only","readme":"# @birtalanrobert/phone\n\nTelephone numbers as the durable identity of a customer, for the markets these\nproducts are sold in.\n\n```ts\nimport { normalisePhone, formatPhone, dialable } from '@birtalanrobert/phone';\n\nnormalisePhone('0722 123 456', 'RO'); // '40722123456'\nnormalisePhone('+40722123456', 'RO'); // '40722123456'  — the same customer\nformatPhone('40722123456', 'RO'); // '0722 123 456'\ndialable('40722123456'); // '+40722123456'\n```\n\n## Three forms, and they are not interchangeable\n\n- **As typed.** Stored beside the normalised form and shown back, because a\n  customer recognises their own number in the shape they write it.\n- **Normalised** — `normalisePhone`. Digits only, country code first. This is\n  what is unique, what is indexed and what is matched on. **It is a search key,\n  not an address.**\n- **Dialable** — `dialable`. E.164, with the plus. What a provider is handed.\n\nThe distinction is not academic: a project shipped a pumping check that refused\nanything without a country code, which refused a perfectly good normalised\n`40722123456` and recorded it as \"not international\". A search key is not\nsomething you can send to.\n\n## What it will not do\n\n**It does not refuse a number.** Anything that cannot be read as a number in the\ngiven market is returned digits-only rather than rejected — a business taking a\ncall from abroad must not be blocked, and a number that only ever matches itself\nis a better outcome than a booking that could not be taken.\n\n`isSearchablePhone` is the softer question the console actually asks: is this\nworth looking up? Offering to search for `07` wastes a second of a\nthirty-second intake.\n\n## Markets\n\nRomania and Hungary. Each carries how the country _writes_ a number down, which\nis not decoration — a customer checking a number on a receipt pattern-matches\nagainst the shape they know, and `0722123456` reads as a different number from\n`0722 123 456` to the person who owns it. Romania joins the trunk prefix to the\nfirst group; Hungary separates it.\n\nAdding a market is one entry in `DIALLING` and its tests.\n","readmeFilename":"README.md","_rev":"1-a6f2020f23a3d3f63e891aba19ed0121"}