-
Notifications
You must be signed in to change notification settings - Fork 1
chore: improve code quality and documentation #2
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: master
Are you sure you want to change the base?
Changes from all commits
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
| @@ -1 +1,40 @@ | ||
| # Dependencies | ||
| node_modules/ | ||
|
|
||
| # Build output | ||
| dist/ | ||
|
|
||
| # IDE | ||
| .idea/ | ||
| .vscode/ | ||
| *.swp | ||
| *.swo | ||
|
|
||
| # OS files | ||
| .DS_Store | ||
| Thumbs.db | ||
|
|
||
| # Logs | ||
| logs/ | ||
| *.log | ||
| npm-debug.log* | ||
| yarn-debug.log* | ||
| yarn-error.log* | ||
|
|
||
| # Coverage | ||
| coverage/ | ||
| .nyc_output/ | ||
|
|
||
| # Environment | ||
| .env | ||
| .env.local | ||
| .env.*.local | ||
|
|
||
| # Temporary files | ||
| tmp/ | ||
| temp/ | ||
| *.tmp | ||
|
|
||
| # Package locks (keep one) | ||
| # Uncomment if you prefer yarn.lock | ||
| # package-lock.json |
| Original file line number | Diff line number | Diff line change | ||||
|---|---|---|---|---|---|---|
| @@ -1,12 +1,31 @@ | ||||||
| # BayDinJS | ||||||
|
|
||||||
| > Myanmar Astrology | ||||||
| > Myanmar Astrology Library for JavaScript | ||||||
|
|
||||||
| [![code style: prettier][prettier]][prettier-url] | ||||||
| [![npm][npm-download]][npm-dl-url] | ||||||
| [![contributions welcome][contri]][contri-url] | ||||||
| [![License: MIT][license]][license-url] | ||||||
|
|
||||||
| A JavaScript library for Myanmar traditional astrology calculations including maharbote, numerology, zodiac signs, and more. | ||||||
|
|
||||||
| ## Table of Contents | ||||||
|
|
||||||
| - [Installation](#installation) | ||||||
| - [Usage](#usage) | ||||||
| - [API Reference](#api-reference) | ||||||
| - [maharbote](#maharboteyear-day) | ||||||
| - [nayNum](#naynumstr) | ||||||
| - [numerology](#numerologynum) | ||||||
| - [numFormat](#numformatnum) | ||||||
| - [tatyout](#tatyoutage-day) | ||||||
| - [chineseZodiac](#chinesezodiacyear) | ||||||
| - [zodiac](#zodiacday-month) | ||||||
| - [Development](#development) | ||||||
| - [Testing](#testing) | ||||||
| - [Contributing](#contributing) | ||||||
| - [License](#license) | ||||||
|
|
||||||
| ## Installation | ||||||
|
|
||||||
| ### via npm | ||||||
|
|
@@ -15,84 +34,224 @@ | |||||
| npm install --save baydin | ||||||
| ``` | ||||||
|
|
||||||
| ### via web | ||||||
| ### via yarn | ||||||
|
|
||||||
| ```shell | ||||||
| yarn add baydin | ||||||
| ``` | ||||||
|
|
||||||
| ### via web (CDN) | ||||||
|
|
||||||
| ```html | ||||||
| <script src="https://unpkg.com/baydin@latest/dist/client/baydin.min.js"></script> | ||||||
| ``` | ||||||
|
|
||||||
| ## Test | ||||||
| ## Usage | ||||||
|
|
||||||
| ```shell | ||||||
| npm test | ||||||
| ### Node.js | ||||||
|
|
||||||
| ```javascript | ||||||
| const baydin = require("baydin"); | ||||||
|
|
||||||
| // Calculate maharbote | ||||||
| const maharboteResult = baydin.maharbote(1356, 1); | ||||||
| console.log(maharboteResult); // "မရဏ" | ||||||
|
|
||||||
| // Get numerology number | ||||||
| const numerologyResult = baydin.numerology(11); | ||||||
| console.log(numerologyResult); // 2 | ||||||
| ``` | ||||||
|
|
||||||
| ## Function List | ||||||
| ### Browser | ||||||
|
|
||||||
| - [maharbote](#maharbote) | ||||||
| - [nayNum](#nayNum) | ||||||
| - [numerology](#numerology) | ||||||
| - [numFormat](#numFormat) | ||||||
| - [tatyout](#tatyout) | ||||||
| ```html | ||||||
| <script src="https://unpkg.com/baydin@latest/dist/client/baydin.min.js"></script> | ||||||
| <script> | ||||||
| const maharboteResult = baydin.maharbote(1356, 1); | ||||||
| console.log(maharboteResult); // "မရဏ" | ||||||
| </script> | ||||||
| ``` | ||||||
|
|
||||||
| ## maharbote | ||||||
| ## API Reference | ||||||
|
|
||||||
| ပုတိ ၊ ဘင်္ဂ ၊ မရဏ ၊ အထွန်း ၊ သိုက် ၊ ရာဇာ ၊ အဓိပတိ ဆိုတဲ့ အဖွား ခုနှစ်ခု ကိုတွက်ထုတ်ပေးမှာဖြစ်ပါတယ်။ ခုနှစ် သက္ကရာဇ်ရယ် မွေးနံ ရယ်ကို ထည့်သွင်းဖို့ လိုအပ်ပါတယ်။ | ||||||
| ### maharbote(year, day) | ||||||
|
|
||||||
| ### Example Code | ||||||
| Calculates the maharbote (astrological influence) based on Myanmar calendar year and birth day of the week. | ||||||
|
|
||||||
| ပုတိ ၊ ဘင်္ဂ ၊ မရဏ ၊ အထွန်း ၊ သိုက် ၊ ရာဇာ ၊ အဓိပတိ ဆိုတဲ့ အဖွား ခုနှစ်ခု ကိုတွက်ထုတ်ပေးမှာဖြစ်ပါတယ်။ | ||||||
|
|
||||||
| **Parameters:** | ||||||
| - `year` (number): Myanmar calendar year (e.g., 1356) | ||||||
| - `day` (number): Day of the week (1-7, where 1 = Sunday, 7 = Saturday) | ||||||
|
|
||||||
| **Returns:** (string) The maharbote name in Myanmar | ||||||
|
|
||||||
| **Example:** | ||||||
| ```javascript | ||||||
| var baydin = require("baydin"); | ||||||
| var mahb = baydin.maharbote(1356, 1); //မရဏ | ||||||
| baydin.maharbote(1356, 1); // "မရဏ" | ||||||
| ``` | ||||||
|
|
||||||
| ## nayNum | ||||||
| --- | ||||||
|
|
||||||
| ### nayNum(str) | ||||||
|
|
||||||
| ထည့်သွင်းလိုက်တဲ့ စာသားကို နေ့သင့်နံသင်ဂဏန်းအဖြစ်ပြောင်းမှာဖြစ်ပါတယ်။ ဥပမာ-nayNum("မင်းဖြူမှန်မှန်ပြော")//55555 | ||||||
| Converts Myanmar text to its numerological equivalent (nay num). | ||||||
|
|
||||||
| ### Example Code | ||||||
| ထည့်သွင်းလိုက်တဲ့ စာသားကို နေ့သင့်နံသင့်ဂဏန်းအဖြစ်ပြောင်းမှာဖြစ်ပါတယ်။ | ||||||
|
|
||||||
| **Parameters:** | ||||||
| - `str` (string): Myanmar text string | ||||||
|
|
||||||
| **Returns:** (number) The numerological number | ||||||
|
|
||||||
| **Example:** | ||||||
| ```javascript | ||||||
| var baydin = require("baydin"); | ||||||
| var nay = baydin.nayNum("မင်းဖြူမှန်မှန်ပြော"); //55555 | ||||||
| baydin.nayNum("မင်းဖြူမှန်မှန်ပြော"); // 55555 | ||||||
| ``` | ||||||
|
|
||||||
| ## numerology | ||||||
| --- | ||||||
|
|
||||||
| ### numerology(num) | ||||||
|
|
||||||
| Calculates the single-digit numerology number from any number. | ||||||
|
|
||||||
| ၁ ဂဏန်း သမား ၂ ဂဏန်း သမား ၉ ဂဏန်းသမား ဆိုပြီးတော့ အမျိုးအစား ၉ မျိုး ရှိပါတယ်။ တွက်နည်းက မွေးရက် ကို တစ်လုံးတည်းရအောင် ပေါင်းရမှာပါ။ | ||||||
|
|
||||||
| ၁ ဂဏန်း သမား ၂ ဂဏန်း သမား ၉ ဂဏန်းသမား ဆိုပြီးတော့ အမျိုးအစား ၉ မျိုး ရှိပါတယ်။ တွက်နည်းက မွေးရက် ကို တစ်လုံးတည်းရအောင် ပေါင်းရမှာပါ။ ဥပမာ-၁၁ ဆိုရင် ၂ ဂဏန်းသမားဖြစ်ပါတယ် | ||||||
| **Parameters:** | ||||||
| - `num` (number): Any positive number | ||||||
|
|
||||||
| ### Example Code | ||||||
| **Returns:** (number) Single digit number (1-9) | ||||||
|
|
||||||
| **Example:** | ||||||
| ```javascript | ||||||
| var baydin = require("baydin"); | ||||||
| var numero = baydin.numerology(11); //2 | ||||||
| baydin.numerology(11); // 2 (1 + 1 = 2) | ||||||
| baydin.numerology(29); // 2 (2 + 9 = 11, 1 + 1 = 2) | ||||||
| ``` | ||||||
|
|
||||||
| ## numFormat | ||||||
| --- | ||||||
|
|
||||||
| ထည့်သွင်းလိုက်တဲ့ ကိန်းဂဏန်းကို စာသားအနေနဲ့ ပြန်ထုတ်ပေးမှာဖြစ်ပါတယ်။ ဥပမာ-numFormat(152)//တစ်ရာငါးဆယ်နှစ် | ||||||
| ### numFormat(num) | ||||||
|
|
||||||
| ### Example Code | ||||||
| Converts a number to Myanmar words. | ||||||
|
|
||||||
| ထည့်သွင်းလိုက်တဲ့ ကိန်းဂဏန်းကို စာသားအနေနဲ့ ပြန်ထုတ်ပေးမှာဖြစ်ပါတယ်။ | ||||||
|
|
||||||
| **Parameters:** | ||||||
| - `num` (number): Number to convert (supports up to 14 digits) | ||||||
|
|
||||||
| **Returns:** (string) Number in Myanmar words | ||||||
|
|
||||||
| **Example:** | ||||||
| ```javascript | ||||||
| var baydin = require("baydin"); | ||||||
| var numF = baydin.numFormat(152); //တစ်ရာငါးဆယ်နှစ် | ||||||
| baydin.numFormat(152); // "တစ်ရာငါးဆယ်နှစ်" | ||||||
| ``` | ||||||
|
|
||||||
| ## tatyout | ||||||
| --- | ||||||
|
|
||||||
| ### tatyout(age, day) | ||||||
|
|
||||||
| အသက် နဲ့ နေ့နံ ကို ထည့်သွင်းလိုက်မယ် ဆိုရင် သက်ရောက်ကို တွက်ထုတ်ပေးပါတယ်။ စနေ့အတွက် ကိုတော့ သုည မဟုတ်ပဲ 7 ကိုပဲထည့်သွင်းပေးစေလိုပါတယ်။ ဥပမာ-သက်ရောက်(1,1)//1 လို့ တွက်ထုတ်ပေးပါတယ်။ | ||||||
| Calculates the tatyout (life influence) based on age and birth day of the week. | ||||||
|
|
||||||
| ### Example Code | ||||||
| အသက် နဲ့ နေ့နံ ကို ထည့်သွင်းလိုက်မယ် ဆိုရင် သက်ရောက်ကို တွက်ထုတ်ပေးပါတယ်။ | ||||||
|
|
||||||
| **Parameters:** | ||||||
| - `age` (number): Age in years | ||||||
| - `day` (number): Day of the week (1-7, where 7 = Saturday) | ||||||
|
|
||||||
| **Returns:** (number) The tatyout number (1-7) | ||||||
|
|
||||||
| **Example:** | ||||||
| ```javascript | ||||||
| var baydin = require("baydin"); | ||||||
| var ty = baydin.tatyout(1, 1); //1 | ||||||
| baydin.tatyout(1, 1); // 1 | ||||||
| ``` | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ### chineseZodiac(year) | ||||||
|
|
||||||
| Gets the Chinese zodiac sign for a given year. | ||||||
|
|
||||||
| **Parameters:** | ||||||
| - `year` (number): Gregorian calendar year (positive integer) | ||||||
|
|
||||||
| **Returns:** (Object) Object containing `sign` (English) and `signInBurmese` (Myanmar) | ||||||
|
|
||||||
| **Example:** | ||||||
| ```javascript | ||||||
| baydin.chineseZodiac(2024); | ||||||
| // { sign: "Dragon", signInBurmese: "နဂါး" } | ||||||
| ``` | ||||||
|
|
||||||
| --- | ||||||
|
|
||||||
| ### zodiac(day, month) | ||||||
|
|
||||||
| Gets the Western zodiac sign based on birth date. | ||||||
|
|
||||||
| **Parameters:** | ||||||
| - `day` (number): Day of birth (1-31) | ||||||
| - `month` (number): Month of birth (1-12) | ||||||
|
|
||||||
| **Returns:** (Object) Object containing `sign` (English) and `sign_mm` (Myanmar) | ||||||
|
|
||||||
| **Throws:** Error if invalid date or month input | ||||||
|
|
||||||
| **Example:** | ||||||
| ```javascript | ||||||
| baydin.zodiac(15, 3); | ||||||
| // { sign: "Pisces", sign_mm: "မိန်" } | ||||||
| ``` | ||||||
|
|
||||||
| ## Development | ||||||
|
|
||||||
| ### Prerequisites | ||||||
|
|
||||||
| - Node.js (v14 or higher recommended) | ||||||
|
||||||
| - Node.js (v14 or higher recommended) | |
| - Node.js (v12 or higher) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The documentation for the
dayparameter is inconsistent with the maharbote function. The maharbote function documentation specifies "1 = Sunday, 7 = Saturday" to clarify the day numbering system, but the tatyout function only specifies "where 7 = Saturday". For consistency and clarity, consider changing this to "Day of the week (1-7, where 1 = Sunday, 7 = Saturday)" to match the pattern used in maharbote documentation on line 85.