Git Product home page Git Product logo

turkish-conjugator's Introduction

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.
}

turkish-conjugator's People

Contributors

pharesdiego avatar dependabot[bot] avatar jaba17 avatar

Watchers

James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.