Registry / productivity / turkey-tel-number-formatter

turkey-tel-number-formatter

JSON →
library1.0.6jsnpmunverified

A small utility (v1.0.6) that extracts and formats Turkish telephone numbers from arbitrary input strings. It strips non-digit characters, detects the leading digit prefix, and outputs in standard Turkish format (e.g., 0 (212) 123 45 68). No dependencies, no configuration. Suitable for Node.js and browser (via bundler). Primarily useful for cleaning user input or displaying raw phone data in a readable Turkish format.

npm install turkey-tel-number-formatter
INSTALL
IMPORT
SIG · TURKEY-TEL-NUMBER-
T
turkey-tel-number-formatter
productivityjavascriptv1.0.6
harness data pending
Install & Compatibility
Where this runs

No compatibility data collected yet for this library.

Code
Verified usage

Verified import paths — ran on the pinned version, not inferred.

ttnf (default)
✓ import ttnf from 'turkey-tel-number-formatter'
✗ const { ttnf } = require('turkey-tel-number-formatter')
Package exports a single default function; named import fails.
require via CJS
✓ const ttnf = require('turkey-tel-number-formatter')
✗ import ttnf from 'turkey-tel-number-formatter' in a CommonJS project
Works in both CJS and ESM projects, but ESM import is preferred for tree-shaking.
global usage
✓ window.ttnf = ttnf
✗ const ttnf = require('turkey-tel-number-formatter') in a browser without bundler
No UMD build; use a bundler or assign to window manually.

Shows how to import and use the formatter to clean a messy string into a Turkish phone number.

const ttnf = require('turkey-tel-number-formatter'); const dirty = '65r3453532434502dfgdfg(/)/(&%/%12123fdgdf(/)/&&4568'; const formatted = ttnf(dirty); console.log(formatted); // '0 (212) 123 45 68' // Another example console.log(ttnf('+90 532 123 45 67')); // '0 (532) 123 45 67'
Debug
Known issues
gotchaInput must contain exactly 10-11 digits after stripping; otherwise returns undefined.
fix
Ensure the input string has at least 10 digits (including leading 0 or country code).
affects: >=1.0.0
gotchaOnly formats numbers with leading 0 (landline) or 5 (mobile) after country code; other prefixes may produce unexpected results.
fix
Only use for Turkish numbers starting with 0 (or +90 then 0/5).
affects: >=1.0.0
gotchaNo international format option; always outputs format 0 (XXX) XXX XX XX.
fix
Manually replace leading '0' with '+90' if needed.
affects: >=1.0.0
gotchaPackage has no TypeScript definitions; TypeScript users must declare module manually.
fix
Add declaration: declare module 'turkey-tel-number-formatter';
affects: >=1.0.0
Errors
Common errors & fixes
TypeError: ttnf is not a function
Attempting to call ttnf as a named import: import { ttnf } from 'turkey-tel-number-formatter'
fix
Use default import: import ttnf from 'turkey-tel-number-formatter' or const ttnf = require('turkey-tel-number-formatter')
Cannot find module 'turkey-tel-number-formatter'
Package not installed or running in an environment without node_modules
fix
Run 'npm install turkey-tel-number-formatter' and ensure the module path is correct.
Upgrade
Version history
1.0.6latest on npm
Audit
Dependencies

No dependency data recorded yet.

Agent activity
34 hits · last 30 days
node
30
OpenAI (training)
2
Resources
turkey-tel-number-formatter — npm install turkey-tel-number-formatter · libregistry