npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

persian-info

v1.0.6

Published

It is good for persian info such as persian bill info, date, and else.

Downloads

18

Readme

PersianInfo

Import

import Persian from "persian-info";

Persian Number

برای فرمت مقادیر و سپریتور گذاشتن

Persian.number.formatPrice(458632); // "458,632"
Persian.number.unformatPrice("458,632"); // "458632";

برای تبدیل عدد به حروف

Persian.number.numberToWords(754465 ); // "هفتصد و پنجاه و چهار هزار و چهارصد و شصت و پنج"
Persian.number.numberToWords(65437347436); // "شش میلیون میلیارد و پانصد و چهل و سه تریلیون و هفتصد و سی و چهار میلیارد و هفتصد و چهل و سه میلیون و ششصد و چهل و یک هزار و سیصد و بیست و چهار "

برای تبدیل عدد فارسی به انگلیسی و یا برعکس

persian.number.convertEnglishNumberToPersian(214124); // "۲۱۴۱۲۴"
persian.number.convertEnglishNumberToPersian("214124"); // "۲۱۴۱۲۴"
Persian.number.convertPersianNumberToEnglish("۲۱۴۱۲۴"); // "214124"

Persian Letter

برای مقایسه کلمات فارسی

const m = 'محمد';
const mr = 'محمدرضا';
Persian.letter.compareString(m, mr); // -1, means mr is bigger
Persian.letter.compareString(mr, m); // 1, means mr is bigger
Persian.letter.compareString(m, m); // 0, means both are same

برای فیکس کردن حروف عربی در کلمات فارسی

const myWord = 'علي';
Persian.letter.convertArabicCharsToPersianChars(myWord); // علی
// no chars like "يك‍دِبِزِذِِشِِسِى" any more.

Persian Date

تبدیل تاریخ میلادی به جلالی

Persian.date.convertDateTimeToJalali(new Date()); // gives you {year, month, day, hours, minutes, seconds, weekday, weekdayName, format}
const d = Persian.date.convertDateTimeToJalali('2019-07-29'); // {year:1398, month:5, day:7, ...}
d.format('dw d mn') // ـ دوشنبه 7 مرداد


Persian.date.convertDateTimeToJalaliString(); // gives you current date in forman yyyy/mm/dd
Persian.date.convertDateTimeToJalaliString('2019-07-29'); // 1398/5/7
Persian.date.convertDateTimeToJalaliString('2019-07-29', 'yy/m/d'); // 98/5/7
Persian.date.convertDateTimeToJalaliString('2019-07-29', 'd mn yy'); // ـ 7 مرداد 98
Persian.date.convertDateTimeToJalaliString('2019-07-29', 'dw d mn yy'); // ـ دوشنبه 7 مرداد 98
Persian.date.convertDateTimeToJalaliString('2019-07-29', 'sw d mn yy'); // ـ د 7 مرداد 98
Persian.date.convertDateTimeToJalaliString('2019-07-29T15:08:07', 'hh hours MM mins ss secs (+gmt) !'); // 15 hours 08 mins 07 secs (+3.5) !

علامت ها :

y = year with one/two digits : 0 thorough 99 yy = year with two digits : 00 thorough 99 yyyy = year with two digits : ??00 thorough ??99 ex. 1379 m = month with one/two digits : 1 thorough 12 mm = month with two digits : 01 thorough 12 d = day with one/two digits : 1 thorough 31 dd = day with two digits : 01 thorough 31

h = hours with one/two digits : 0 thorough 59 hh = hours with two digits : 00 thorough 59 M = minutes with one/two digits : 0 thorough 59 MM = minutes with two digits : 00 thorough 59 s = seconds with one/two digits : 0 thorough 59 ss = seconds with two digits : 00 thorough 59

dw = the number of the day in week : 0 (saturday) thorough 6 (friday) dn = the name of the day in week : شنبه or یکشنبه or دوشنبه or سه‌شنبه or etc. ds = the first letter of the day in week : ش or ی or د or س or چ or پ or ج

تبدیل تاریخ جلالی به میلادی

Persian.date.convertJalaliToGregorian({year:1398, month:5, day:7}); // returns an object of type `Date`

گرفتن تاریخ امروز به جلالی

Persian.date.getJalaliNow(); // today's jalali date

گرفتن اولین روز هفته در یک ماه مشخص (مثلا اولین روز مهر 98 دوشنبه است.)

Persian.date.getJalaliMonthFirstWeekDay(1398, 7); // 2
Persian.date.getJalaliMonthFirstWeekDay(98, 7); // 2

گرفتن تعداد روزهای یک ماه مشخص

Persian.date.getJalaliMonthDaysCount(1398, 7); // 30
Persian.date.getJalaliMonthDaysCount(98, 12); // 29
Persian.date.getJalaliMonthDaysCount(98, 6); // 31

گرفتن مشخصات فارسی ماه و هفته

Persian.date.monthNames; // ['فروردین', 'اردیبهشت', 'خرداد', 'تیر', 'مرداد', 'شهریور', 'مهر', 'آبان', 'آذر', 'دی', 'بهمن', 'اسفند']
Persian.date.weekNames; // ['شنبه', 'یکشنبه', 'دوشنبه', 'سه‌شنبه', 'چهارشنبه', 'پنجشنبه', 'جمعه']

Persian Bill

برای گرفتن اطلاعات قبض از کلاس PersianBillExtractor استفاده کنید

const paymentInfo = Persian.bill.getPaymentInfo(paymentId); // {billPrice, yearCode, period}

const billInfo = Persian.bill.getBillInfo(billId); // {serviceType, placeCode, subscribeNumber, serviceImage}