Skip to main content

Usage Guide

Persian Tools provides a comprehensive set of utilities for Persian language processing. This guide covers the fundamental patterns and best practices for using the library.

Import Patterns

Import only the utilities you need for optimal bundle size:

Namespace Import

Import the entire library under a namespace:

CommonJS

For Node.js environments using CommonJS:

Core Patterns

Number Processing

Text Validation

Validation

Configuration Options

Many utilities accept configuration objects for customized behavior:

Number Conversion Options

Text Processing Options

Error Handling

Persian Tools utilities are designed to be robust and handle edge cases gracefully:

Performance Considerations

Import utilities individually to enable tree-shaking and reduce bundle size.
For repeated operations with the same input, consider implementing your own caching layer.
For processing large datasets, process items in batches to avoid blocking the main thread.

TypeScript Support

Persian Tools provides comprehensive TypeScript definitions:

Next Steps

Examples

Explore practical examples and common use cases

Number Utilities

Learn about number processing utilities