Skip to content
This repository has been archived by the owner on Apr 22, 2022. It is now read-only.

dalirnet/persian-to-slug

Repository files navigation

persian-to-slug

Slugifies persian (simple and clean)

Use

  • CDN
<script src="https://unpkg.com/persian-to-slug@latest/dist/persian-to-slug.js"></script>
  • Npm
const PersianToSlug = require("persian-to-slug");

/* 
    PersianToSlug(
        input,
        part = 6,
        separator = "-",
        myWords = {}
    )
*/

PersianToSlug("عنوان Article، به زبان فارسی");

/* => "title-article-language-farsi" */

Test

√ PersianToSlug(
    "عنوان Article، به زبان فارسی"
    )

    => "title-article-language-farsi" (8 ms)


√ PersianToSlug(
    "عنوان Article، به زبان فارسی",
    2
    )

    => "title-article" (1 ms)


√ PersianToSlug(
    "عنوان Article، به زبان فارسی",
    3,
    "_"
    )

    => "title_article_language" (1 ms)


√ PersianToSlug(
    "عنوان Article، به زبان فارسی",
    6,
    "___",
    { "زبان": "zaban" }
    )

    => "title___article___zaban___farsi" (1 ms)