Skip to main content

Installation

Persian Tools is available via a npm package and supports multiple JavaScript or TypeScript environments, including Node.js, Bun, and modern browsers.

Package Manager Installation

npm install @persian-tools/persian-tools

CDN Usage

For browser, environments, you can use Persian Tools directly from a CDN:
<script src="https://cdn.jsdelivr.net/npm/@persian-tools/persian-tools@latest/build/cjs/persian-tools.js"></script>

Requirements

Compatibility

  • Node.js: 14+ (ESM and CommonJS support) - Bun: Latest versions - Browsers: Modern browsers with ES2018+ support - TypeScript: 4.0+ (optional, but recommended)

Bundle Sizes

Persian Tools is designed to be lightweight and tree-shakable:
  • Minified: ~127KB gzipped
  • Uncompressed: ~830KB
  • Contains all 27+ utilities
  • Single utility: ~1-3KB gzipped
  • Typical usage: ~8-15KB gzipped
  • Modern bundlers automatically optimize

Environment Support

Node.js & Bun

Full support for server-side applications with both CommonJS and ESM imports

Browsers

Works in all modern browsers with native ES modules or bundled applications

TypeScript

First-class TypeScript support with comprehensive type definitions

Bundlers

Compatible with Webpack, Vite, Rollup, and other modern bundlers

Verification

After installation, verify everything works correctly:
import { numberToWords } from "persian-tools";

console.log(numberToWords(1234)); // "یک هزار و دویست و سی و چهار"
If you encounter any installation issues, please check our troubleshooting guide or create a new issue on GitHub.

Next Steps