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

wordifyfa

v1.4.1

Published

Persian Wordifier converts simple numbers to words. for example you can use this:

Downloads

167

Readme

Persian Wordifier converts numbers to words. for example you can use this:

var a = 235000;
var b = wordifyfa(a);
console.log(b); // دویست و سی و پنج هزار
var c = wordifyRials(a); // دویست و سی و پنج هزار ریال
var d = wordifyRialsInTomans(a); // بیست و سه هزار و پانصد تومان
var e = wordifyMomentApprox(new Date(2022,4,4,10,20,0)); // هفت ساعت پیش 
var f = wordifyMomentApprox(new Date(2022,4,4,10,20,0), new Date(2022,4,4,10,21,0), "قبل","بعد"); // یک دقیقه بعد 
var g = wordifyMomentApprox("2022-05-04 10:20:00"); // هفت ساعت پیش
var h = momentApprox("2022-05-04 10:20:00"); // 7 ساعت پیش
var i = wordifyMomentPrecise("2022-05-04 10:20:00"); // هفت ساعت و پنج دقیقه و بیست ثانیه پیش
var j = momentPrecise("2022-05-04 10:20:00"); // 7 ساعت و 5 دقیقه و 20 ثانیه پیش

Warning! in javascript, month starts from zero so new Date(2022,4,4,10,20,0) means month 5 (May)

update (2022-07-14)

  • precise time calculation added

update (2022-05-15)

  • approximate time calculation added

update (2020-05-15)

  • project source reimplemented in typescript

update (2020-04-18)

  • npm package created (npm i wordifyfa)

update (2020-03-11)

  • non english digits support (arabic/persian)
var a = '۱۲۰۳۴۵۱۰۲';
var b = wordifyfa(a);
console.log(b); // یکصد و بیست میلیون و سیصد و چهل و پنج هزار و صد و یکصد و دو

update (2019-09-11)

  • string and thousands separated numbers now supported
var a = '120,345,102';
var b = wordifyfa(a);
console.log(b); // یکصد و بیست میلیون و سیصد و چهل و پنج هزار و صد و یکصد و دو

installation:

1- add this line of code in your html.

<script src="wordifyfa.js"></script>

or if you are using Node.js

npm i wordifyfa
var wf = require('wordifyfa.js');

2- use the code.

in javascript:

    var a = 93390;
    var b = wordifyfa(a); // نود و سه هزار و سیصد و نود

in Node.js:

    var a = 93390;
    var b = wf.wordifyfa(a); // نود و سه هزار و سیصد و نود

following examples are in javascript. if you want use it in Node.js, you must change it as same as previous sample.

functions:

1 converts number to words

	wordifyfa(number) 
	wordifyfa(43); // چهل و سه

or in Node.js :

	var a = require('./wordifyfa.js');
	a.wordifyfa(number);

2 converts number to words with Rial sign

	wordifyRials(number) 
	wordifyRials(400); // چهارصد ریال

or in Node :

	var a = require('./wordifyfa.js');
	a.worifyfaRials(number);

3 converts number that is in Rials to Tomans and wordifies it

	wordifyRialsInTomans(number) 
	wordifyRialsInTomans(5000); // پانصد تومان

or in Node :

	var a = require('./wordifyfa.js');
	a.wordifyRialsInTomans(number);

4 supports converting persian and arabic digits

	wordifyfa('۱۲۰۰۰۰')

5 convert dates to approximate time in words

	wordifyMomentApprox(date,[base date=current time],[suffix if date is before base date='پیش'], [suffix if date is after base date = 'بعد']);
	// date and base date can be string or date object
	// base date and suffixes are optional

6 convert dates to approximate time in digits

	momentApprox(date,[base date=current time],[suffix if date is before base date='پیش'], [suffix if date is after base date = 'بعد']);
	// date and base date can be string or date object
	// base date and suffixes are optional

7 convert dates to precise time difference (year/month/week/day/hour/minute/second) in words

	wordifyMomentPrecise(date,[base date=current time],[suffix if date is before base date='پیش'], [suffix if date is after base date = 'بعد']);
	// date and base date can be string or date object
	// base date and suffixes are optional

8 convert dates to precise time difference (year/month/week/day/hour/minute/second) in digits

	momentPrecise(date,[base date=current time],[suffix if date is before base date='پیش'], [suffix if date is after base date = 'بعد']);
	// date and base date can be string or date object
	// base date and suffixes are optional

more info:

this code now supports max to 999,999,999,999,999. is it sufficient?

Main Contributors