/m3dood

A function to get the grammatically correct "m3dood" for a number in Arabic.

Primary LanguageJavaScriptMIT LicenseMIT

Build Status NPM

M3dood معدود

A function to get the grammatically correct "m3dood" for a number in Arabic.

دالة توفر المعدود العربي الصحيح نحوياً للرقم المعطى


Provides the grammatically correct "m3dood" for a number.

  • Simple detection of entity gender
  • Handles entity counts from 0 to 99+

Download & Installation

$ yarn add m3dood
$ npm i m3dood

Usage

import m3dood from 'm3dood';

// initilize your ma3dood
const books = m3dood("كتاب", "كتابان", "كتب");
const libraries = m3dood("مكتبة", "مكتبتان", "مكتبات");

// use it
console.log(books(3), libraries(2));

this will return

"3 كتب"
"مكتبتان"

Examples

  • دون كتب
  • كتاب واحد
  • كتابان
  • 3 كتب
  • 10 كتب
  • 11 كتاب
  • 101 من الكتب
  • 103 كتب

Contributing

Keep it simple. Keep it minimal. Don't put every single feature just because you can.

Authors or Acknowledgments

License

This project is licensed under the MIT License