npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2025 – Pkg Stats / Ryan Hefner

tr-slugify

v1.2.1

Published

Türkçe özel karakterleri doğru çeviren ve URL için mükemmel slug'lar oluşturan npm paketi

Readme

tr-slugify

Türkçe özel karakterleri doğru çeviren ve URL için mükemmel slug'lar oluşturan npm paketi.

npm version npm downloads License: MIT

📦 NPM Paketi

📥 Kurulum: npm install tr-slugify
🔗 NPM Sayfası: https://www.npmjs.com/package/tr-slugify

Özellikler

  • ✅ Türkçe özel karakterleri doğru çevirme (ç→c, ğ→g, ı→i, İ→I, ö→o, ş→s, ü→u)
  • ✅ URL-friendly slug oluşturma
  • ✅ Özelleştirilebilir ayırıcı karakterler
  • ✅ Çoklu metin işleme
  • ✅ Benzersiz slug oluşturma
  • ✅ TypeScript desteği
  • ✅ Kapsamlı test coverage
  • ✅ Sıfır bağımlılık

Kurulum

npm install tr-slugify

veya

yarn add tr-slugify

Kullanım

Temel Kullanım

import { trSlugify } from 'tr-slugify';

// Basit kullanım
trSlugify('Türkçe Metin'); // 'turkce-metin'

// Türkçe karakterler
trSlugify('çay'); // 'cay'
trSlugify('ağaç'); // 'agac'
trSlugify('ırmak'); // 'irmak'
trSlugify('İstanbul'); // 'istanbul'
trSlugify('gözlük'); // 'gozluk'
trSlugify('şeker'); // 'seker'
trSlugify('güneş'); // 'gunes'

Gelişmiş Kullanım

import { trSlugify, trSlugifyMultiple, trSlugifyUnique } from 'tr-slugify';

// Seçeneklerle kullanım
trSlugify('Türkçe Metin', {
  separator: '_',        // Ayırıcı karakter (varsayılan: '-')
  lowercase: false,      // Küçük harfe çevirme (varsayılan: true)
  removeSpecialChars: true, // Özel karakterleri kaldır (varsayılan: true)
  collapseSeparators: true, // Çoklu ayırıcıları tek ayırıcıya çevir (varsayılan: true)
  trimSeparators: true   // Başındaki ve sonundaki ayırıcıları kaldır (varsayılan: true)
});

// Çoklu metin işleme
const texts = ['Türkçe', 'İngilizce', 'Almanca'];
trSlugifyMultiple(texts); // ['turkce', 'ingilizce', 'almanca']

// Benzersiz slug oluşturma
const existingSlugs = ['test', 'test-1'];
trSlugifyUnique('test', existingSlugs); // 'test-2'

API Referansı

trSlugify(text, options?)

Ana slugify fonksiyonu.

Parametreler:

  • text (string): Çevrilecek metin
  • options (SlugifyOptions, opsiyonel): Slugify seçenekleri

Dönen değer: URL-friendly slug string

trSlugifyMultiple(texts, options?)

Birden fazla metni slug'a çevirir.

Parametreler:

  • texts (string[]): Çevrilecek metinler dizisi
  • options (SlugifyOptions, opsiyonel): Slugify seçenekleri

Dönen değer: Slug'lar dizisi

trSlugifyUnique(text, existingSlugs?, options?)

Benzersiz slug oluşturur.

Parametreler:

  • text (string): Çevrilecek metin
  • existingSlugs (string[], opsiyonel): Mevcut slug'lar dizisi
  • options (SlugifyOptions, opsiyonel): Slugify seçenekleri

Dönen değer: Benzersiz slug string

SlugifyOptions Interface

interface SlugifyOptions {
  separator?: string;           // Ayırıcı karakter (varsayılan: '-')
  lowercase?: boolean;          // Küçük harfe çevir (varsayılan: true)
  removeSpecialChars?: boolean; // Özel karakterleri kaldır (varsayılan: true)
  collapseSeparators?: boolean; // Çoklu ayırıcıları tek ayırıcıya çevir (varsayılan: true)
  trimSeparators?: boolean;     // Başındaki ve sonundaki ayırıcıları kaldır (varsayılan: true)
}

Örnekler

Blog Başlıkları

trSlugify('Türkçe SEO Optimizasyonu Nasıl Yapılır?');
// 'turkce-seo-optimizasyonu-nasil-yapilir'

trSlugify('React.js ile Modern Web Uygulamaları');
// 'react-js-ile-modern-web-uygulamalari'

Ürün İsimleri

trSlugify('iPhone 14 Pro Max 256GB');
// 'iphone-14-pro-max-256gb'

trSlugify('Samsung Galaxy S23 Ultra');
// 'samsung-galaxy-s23-ultra'

Şehir İsimleri

trSlugify('İstanbul, Türkiye');
// 'istanbul-turkiye'

trSlugify('Ankara - Başkent');
// 'ankara-baskent'

Özel Ayırıcılar

trSlugify('Türkçe Metin', { separator: '_' });
// 'turkce_metin'

trSlugify('Test Metin', { separator: '.' });
// 'test.metin'

Büyük Harf Koruma

trSlugify('TürkÇe', { lowercase: false });
// 'TürkCe'

Geliştirme

Kurulum

git clone https://github.com/ahmetseha/tr-slugify.git
cd tr-slugify
npm install

Test Çalıştırma

npm test

Build

npm run build

Lisans

Bu proje MIT lisansı altında lisanslanmıştır. Detaylar için LICENSE dosyasına bakın.

Changelog

v1.0.0

  • İlk sürüm
  • Türkçe karakter desteği
  • Temel slugify fonksiyonları
  • TypeScript desteği
  • Kapsamlı test coverage