0.5.1 • Published 1 year ago

achar-js v0.5.1

Weekly downloads
25
License
GPL-2.0
Repository
-
Last release
1 year ago

Achar

All the utility functions you'll need to build a fully functional e-commerce site
Created with :heart: and :coffee: by the Basalam developers

Version Badge Downloads Badge License Badge
Size Badge Stars Badge

Getting started

Achar is an open-source, free project developed by the Basalam developers. You can use the achar-js package in your e-commerce project by installing it from npm

$ npm install achar-js // Or $ npm install --save achar-js for npm < 5.0.0

Or

$ yarn add achar-js

Basic usage

You can use achar-js like any other JavaScript package.

// Full Import
import * as achar from "achar-js"

achar.rialToToman(20000, { currencry: true, separator: true }) // تومان 2,000

// Import multiple utilities
import { rialToToman, isObject } from "achar-js"

isObject({}) // true
rialToToman(20000, { currencry: true, separator: true }) // تومان 2,000

// Single use (Default Exported)
import rialToToman from "achar-js/rialToToman"

rialToToman(20000, { currencry: true, separator: true }) // تومان 2,000

Usage

Here you can see an overview of the different utilities available and how they work

convertToSnakeCase

Converts snake_case words to camelCase

import { convertToSnakeCase } from "achar-js"

convertToSnakeCase("message_status") // messageStatus

It's also works with javascript objects or arrays

convertToSnakeCase({ message_status: "dont_touch", items: ["camel_me"] }) // { messageStatus: "dont_touch", items: ["camelMe"] }

generateUniqueId

Generates a unique id with the requested length

import { generateUniqueId } from "achar-js"

generateUniqueId(16) // fk5ghtmvlprt2zyn

isObject

Checks whether the input value is an object or not

import { isObject } from "achar-js"

isObject({}) // true
isObject([]) // false
isObject([]) // false

numberSeparator

Separates the inputted number

import { numberSeparat } from "achar-js"

numberSeparat(2000) // "2,000"
numberSeparat("2000") // "2,000"

rialToToman

Converts Rials to Tomans

import { rialToToman } from "achar-js"

rialToToman(20000) // 2000
rialToToman("20000") // "2000"
rialToToman("20000", { currency: true }) // "2000 تومان"
rialToToman("20000", { separator: true }) // "2,000"

rialToHumanizeToman

Converts Rials to Tomans in a human-readable form

import { rialToHumanizeToman } from "achar-js"

rialToHumanizeToman(20000) // "2,000 تومان"

toEnglishDigits

Converts Arabic or Persian numbers to English

import { toEnglishDigits } from "achar-js"

toEnglishDigits("۴۰۰۰ بار سلام بر تو") // "4000 بار سلام بر تو"
toEnglishDigits("٤۰۰۰ تحية لكم") // "4000 تحياتي لكم"
0.5.0

1 year ago

0.4.0

1 year ago

0.5.1

1 year ago

0.3.0

3 years ago

0.2.0

3 years ago

0.1.0

3 years ago

0.1.1

3 years ago

0.0.1

3 years ago

0.0.2-0

3 years ago