{"id":42155,"library":"turkey-tel-number-formatter","title":"Turkey Tel Number Formatter","description":"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.","status":"active","version":"1.0.6","language":"javascript","source_language":"en","source_url":"https://github.com/bhdrgkz/turkey-tel-number-formatter","tags":["javascript","cases","turkey","tel number formatter","telephone","tel","phone number","number","turkish"],"install":[{"cmd":"npm install turkey-tel-number-formatter","lang":"bash","label":"npm"},{"cmd":"yarn add turkey-tel-number-formatter","lang":"bash","label":"yarn"},{"cmd":"pnpm add turkey-tel-number-formatter","lang":"bash","label":"pnpm"}],"dependencies":[],"imports":[{"note":"Package exports a single default function; named import fails.","wrong":"const { ttnf } = require('turkey-tel-number-formatter')","symbol":"ttnf (default)","correct":"import ttnf from 'turkey-tel-number-formatter'"},{"note":"Works in both CJS and ESM projects, but ESM import is preferred for tree-shaking.","wrong":"import ttnf from 'turkey-tel-number-formatter' in a CommonJS project","symbol":"require via CJS","correct":"const ttnf = require('turkey-tel-number-formatter')"},{"note":"No UMD build; use a bundler or assign to window manually.","wrong":"const ttnf = require('turkey-tel-number-formatter') in a browser without bundler","symbol":"global usage","correct":"window.ttnf = ttnf"}],"quickstart":{"code":"const ttnf = require('turkey-tel-number-formatter');\n\nconst dirty = '65r3453532434502dfgdfg(/)/(&%/%12123fdgdf(/)/&&4568';\nconst formatted = ttnf(dirty);\nconsole.log(formatted); // '0 (212) 123 45 68'\n\n// Another example\nconsole.log(ttnf('+90 532 123 45 67')); // '0 (532) 123 45 67'","lang":"javascript","description":"Shows how to import and use the formatter to clean a messy string into a Turkish phone number."},"warnings":[{"fix":"Ensure the input string has at least 10 digits (including leading 0 or country code).","message":"Input must contain exactly 10-11 digits after stripping; otherwise returns undefined.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Only use for Turkish numbers starting with 0 (or +90 then 0/5).","message":"Only formats numbers with leading 0 (landline) or 5 (mobile) after country code; other prefixes may produce unexpected results.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Manually replace leading '0' with '+90' if needed.","message":"No international format option; always outputs format 0 (XXX) XXX XX XX.","severity":"gotcha","affected_versions":">=1.0.0"},{"fix":"Add declaration: declare module 'turkey-tel-number-formatter';","message":"Package has no TypeScript definitions; TypeScript users must declare module manually.","severity":"gotcha","affected_versions":">=1.0.0"}],"env_vars":null,"search_vec":"'0':38 '123':40 '212':39 '45':41 '68':42 'arbitrari':17 'browser':51 'bundler':53 'case':71 'charact':25 'clean':57 'configur':46 'data':64 'depend':44 'detect':26 'digit':24,29 'display':61 'e.g':37 'extract':10 'format':12,36,69 'formatt':4,75 'input':18,59 'javascript':70 'lead':28 'node.js':49 'non':23 'non-digit':22 'number':3,15,74,79,80 'output':32 'phone':63,78 'prefix':30 'primarili':54 'raw':62 'readabl':67 'small':6 'standard':34 'string':19 'strip':21 'suitabl':47 'tel':2,73,77 'telephon':14,76 'turkey':1,72 'turkish':13,35,68,81 'use':55 'user':58 'util':7 'v1.0.6':8 'via':52","created_at":"2026-06-04T18:55:53.111368+00:00","updated_at":"2026-06-04T18:55:53.111368+00:00","problems":[{"fix":"Use default import: import ttnf from 'turkey-tel-number-formatter' or const ttnf = require('turkey-tel-number-formatter')","cause":"Attempting to call ttnf as a named import: import { ttnf } from 'turkey-tel-number-formatter'","error":"TypeError: ttnf is not a function"},{"fix":"Run 'npm install turkey-tel-number-formatter' and ensure the module path is correct.","cause":"Package not installed or running in an environment without node_modules","error":"Cannot find module 'turkey-tel-number-formatter'"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/bhdrgkz/turkey-tel-number-formatter","github":"https://github.com/bhdrgkz/turkey-tel-number-formatter","docs":null,"changelog":null,"pypi":null,"npm":"turkey-tel-number-formatter","openapi_spec":null,"status_page":null,"smithery":null,"categories":["productivity"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-04","next_check":"2026-09-02","install_tag":null}}