Skip to content

pharesdiego/turkish-conjugator

Repository files navigation

turkish-conjugator npm version

The first Turkish conjugator without wrong conjugations!

Getting Started

Install:

npm i turkish-conjugator

or

yarn add turkish-conjugator

Use in your project:

const Turkish = require('turkish-conjugator')

But since you're a cool guy you'll use:

import Turkish from 'turkish-conjugator'

Also avaliable as a script tag:

<script src='https://unpkg.com/turkish-conjugator/dist/web.bundle.js'></script>

Methods

Turkish.it(verb: string)

Arguments:

verb: A valid Turkish verb in its positive form like: gelmek, izin vermek, istemek, yaşamak...

Returns:

This method returns an array of objects with the following structure:

[
  {
    title: string,
    conjugation: {
      positive: array,
      negative: array
    }
  },
  ...
]

Here you can see a full example of the output for Turkish.it('gelmek')

These are the supported tenses so far:

Aorist, Gerund (Present Continuous), Future, Simple Past, Miş Past, Past Continuous, Present Indefinite, Gerund Indefinite, Future Indefinite, Potential.

Turkish.isTurkishVerb(verb: string)

Arguments:

verb: A Turkish verb in any form like: gelmek, izin vermek, istememek, yaşamamak...

Returns:

This method returns a valid verb or an empty string if the passed verb is not a valid Turkish verb.

  • If the passed verb does not follow every Turkish rule about verbs and their structure then it will return an empty string.

  • If it follows every rule and has a valid structure:

    • If the given string is a Turkish verb in its negative form (like gelmemek), it will return the given verb in its positive form (gelmemek -> gelmek).

    • If the given verb is in its positive form this same verb will be returned.

Examples:

Turkish.isTurkishVerb('gelmek') // 'gelmek'

Turkish.isTurkishVerb('gelmemek') // 'gelmek'

Turkish.isTurkishVerb('GelMemEK') // 'gelmek'

Turkish.isTurkishVerb('xmek') // ''

Turkish.isTurkishVerb('gelmekk') // ''

At Konjüsh this method's output is used as input for Turkish.it in this way:

const isTurkishVerb = Turkish.isTurkishVerb('gelmek');
if(isTurkishVerb) {
  Turkish.it(isTurkishVerb);
} else {
  // Show up an invalid Turkish verb message.
}

About

A turkish conjugator that does it very well :)

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published