Skip to content
This repository was archived by the owner on May 20, 2023. It is now read-only.

basalam/achar-js

Repository files navigation

Achar

All the utility functions you'll need to build a fully functional e-commerce site
Created with ❤️ and ☕ 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


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"] }

Generates a unique id with the requested length

import { generateUniqueId } from "achar-js"

generateUniqueId(16) // fk5ghtmvlprt2zyn

Checks whether the input value is an object or not

import { isObject } from "achar-js"

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

Separates the inputted number

import { numberSeparat } from "achar-js"

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

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"

Converts Rials to Tomans in a human-readable form

import { rialToHumanizeToman } from "achar-js"

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

Converts Arabic or Persian numbers to English

import { toEnglishDigits } from "achar-js"

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

About

All the utility functions you'll need to build a fully functional e-commerce site

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Contributors 2

  •  
  •