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 🙏

© 2026 – Pkg Stats / Ryan Hefner

turkish-harmony-suffixes

v1.0.2

Published

A package for Turkish suffixes, using the harmony of the Turkish language

Downloads

133

Readme

Turkish Suffix Library

A TypeScript library for handling Turkish language suffixes with proper vowel harmony and consonant softening rules.

Features

  • ✅ Full support for Turkish vowel harmony (2-way and 4-way)
  • ✅ Automatic consonant softening (yumuşama)
  • ✅ Proper noun handling with apostrophes
  • ✅ Foreign word support
  • ✅ Abbreviation handling
  • ✅ TypeScript support with full type safety
  • ✅ Zero dependencies
  • ✅ Comprehensive test coverage

Installation

npm install turkish-suffixes

or with Yarn:

yarn add turkish-suffixes

or with Bun:

bun add turkish-suffixes

Usage

import { withTurkishSuffix, TurkishCase } from 'turkish-suffixes';

// Plural
withTurkishSuffix('ev', TurkishCase.PLURAL); // 'evler'
withTurkishSuffix('araba', TurkishCase.PLURAL); // 'arabalar'

// Possessive
withTurkishSuffix('ev', TurkishCase.POSSESSIVE); // 'evin'
withTurkishSuffix('araba', TurkishCase.POSSESSIVE); // 'arabanın'

// Dative (to/for)
withTurkishSuffix('ev', TurkishCase.DATIVE); // 'eve'
withTurkishSuffix('okul', TurkishCase.DATIVE); // 'okula'

// Accusative (direct object)
withTurkishSuffix('ev', TurkishCase.ACCUSATIVE); // 'evi'
withTurkishSuffix('araba', TurkishCase.ACCUSATIVE); // 'arabayı'

// Locative (at/in/on)
withTurkishSuffix('ev', TurkishCase.LOCATIVE); // 'evde'
withTurkishSuffix('masa', TurkishCase.LOCATIVE); // 'masada'

// Ablative (from)
withTurkishSuffix('ev', TurkishCase.ABLATIVE); // 'evden'
withTurkishSuffix('okul', TurkishCase.ABLATIVE); // 'okuldan'

API Reference

withTurkishSuffix(text: string, suffix: TurkishCase): string

Applies a Turkish suffix to the given text with proper vowel harmony.

Parameters

  • text: The word to apply the suffix to
  • suffix: The type of suffix to apply (from TurkishCase enum)

TurkishCase Enum

enum TurkishCase {
    PLURAL = 'PLURAL', // -lar/-ler
    POSSESSIVE = 'POSSESSIVE', // -(n)ın/-(n)in/-(n)un/-(n)ün
    DATIVE = 'DATIVE', // -(y)a/-(y)e
    ACCUSATIVE = 'ACCUSATIVE', // -(y)ı/-(y)i/-(y)u/-(y)ü
    LOCATIVE = 'LOCATIVE', // -da/-de/-ta/-te
    ABLATIVE = 'ABLATIVE', // -dan/-den/-tan/-ten
    KI = 'ki' // -ki (unchanging)
}

Special Features

Proper Nouns

Proper nouns are automatically detected and handled with apostrophes:

withTurkishSuffix('Ali', TurkishCase.DATIVE); // "Ali'ye"
withTurkishSuffix('İstanbul', TurkishCase.LOCATIVE); // "İstanbul'da"
withTurkishSuffix('Ankara', TurkishCase.ABLATIVE); // "Ankara'dan"

Foreign Words

Mark foreign words with |y flag to prevent consonant softening:

withTurkishSuffix('computer|y', TurkishCase.POSSESSIVE); // "computer'ın"
withTurkishSuffix('laptop|y', TurkishCase.ACCUSATIVE); // "laptop'u"

Consonant Softening

The library automatically applies consonant softening rules:

withTurkishSuffix('kitap', TurkishCase.POSSESSIVE); // "kitabın" (p → b)
withTurkishSuffix('ağaç', TurkishCase.DATIVE); // "ağaca" (ç → c)
withTurkishSuffix('renk', TurkishCase.POSSESSIVE); // "rengin" (k → g)

Numbers and Abbreviations

withTurkishSuffix('2024', TurkishCase.LOCATIVE); // "2024'te"
withTurkishSuffix('TV', TurkishCase.DATIVE); // "TV'ye"
withTurkishSuffix('GPS', TurkishCase.ABLATIVE); // "GPS'den"

Vowel Harmony Rules

The library automatically applies Turkish vowel harmony rules:

2-Way Harmony (a/e)

  • Back vowels (a, ı, o, u) → -a
  • Front vowels (e, i, ö, ü) → -e

4-Way Harmony (ı/i/u/ü)

  • Back unrounded (a, ı) → -ı
  • Back rounded (o, u) → -u
  • Front unrounded (e, i) → -i
  • Front rounded (ö, ü) → -ü

Examples

Complete Example

import { withTurkishSuffix, TurkishCase } from 'turkish-suffixes';

const word = 'ev';

console.log(`${word}'in halleri:`);
console.log(`Çoğul: ${withTurkishSuffix(word, TurkishCase.PLURAL)}`); // evler
console.log(`İyelik: ${withTurkishSuffix(word, TurkishCase.POSSESSIVE)}`); // evin
console.log(`Yönelme: ${withTurkishSuffix(word, TurkishCase.DATIVE)}`); // eve
console.log(`Belirtme: ${withTurkishSuffix(word, TurkishCase.ACCUSATIVE)}`); // evi
console.log(`Bulunma: ${withTurkishSuffix(word, TurkishCase.LOCATIVE)}`); // evde
console.log(`Ayrılma: ${withTurkishSuffix(word, TurkishCase.ABLATIVE)}`); // evden

Real-world Usage

// Building sentences
const city = 'İstanbul';
const person = 'Ahmet';

console.log(`${withTurkishSuffix(person, TurkishCase.POSSESSIVE)} arabası`); // Ahmet'in arabası
console.log(`${withTurkishSuffix(city, TurkishCase.LOCATIVE)} yaşıyor`); // İstanbul'da yaşıyor
console.log(`${withTurkishSuffix(city, TurkishCase.ABLATIVE)} geliyor`); // İstanbul'dan geliyor

Development

Building

bun run build

Testing

bun test

Running Examples

bun run examples/usage.ts

Contributing

Contributions are welcome! Please feel free to submit a Pull Request.

  1. Fork the repository
  2. Create your feature branch (git checkout -b feature/amazing-feature)
  3. Commit your changes (git commit -m 'Add some amazing feature')
  4. Push to the branch (git push origin feature/amazing-feature)
  5. Open a Pull Request

License

This project is licensed under the MIT License - see the LICENSE file for details.

Author

Semih Ayhan - @smhayhan

Acknowledgments

  • Thanks to all contributors who have helped improve this library
  • Inspired by the beauty and complexity of the Turkish language