# React Pakistan — Util Functions

React Pakistan is an open-source platform creating React software solutions for the global community.

A central library of utility functions, hooks, constants, and factories for the React Pakistan ecosystem.

## Table of Contents

- [Tech Stack](#tech-stack)
- [Installation](#installation)
- [Usage](#usage)
- [Tests](#tests)
- [Ecosystem](#ecosystem)
- [Contributors](#contributors)
- [Support](#support)

## Tech Stack

React · TypeScript · Styled Components · Vitest · ESLint

## Installation

```sh
yarn add @react-pakistan/util-functions
# or
npm install @react-pakistan/util-functions
```

### Development

```sh
git clone <repo-url>
cd util-functions
yarn
yarn test        # run all tests
yarn test:watch  # watch mode
yarn build       # build the library
```

## Usage

> This package has **no barrel exports**. Import functions directly from their file paths.

```ts
// General utilities
import { slugify } from '@react-pakistan/util-functions/general/slugify';
import { validateEmail } from '@react-pakistan/util-functions/general/validate-email';
import { formatDate } from '@react-pakistan/util-functions/general/format-date';

// Hooks
import { useDebounce } from '@react-pakistan/util-functions/hooks/use-debounce';
import { useRTL } from '@react-pakistan/util-functions/hooks/use-rtl';

// Constants
import { API_METHODS } from '@react-pakistan/util-functions/constants/api-methods';
import { COUNTRIES_TIMEZONES } from '@react-pakistan/util-functions/constants/countries-timezones';

// Local storage
import { getStorageValue } from '@react-pakistan/util-functions/local-storage/get-storage-value';

// Factories
import { genericComponentFactory } from '@react-pakistan/util-functions/factory/generic-component-factory';
```

## Tests

![Test Coverage Branches](https://util-functions.surge.sh/badge-branches.svg)
![Test Coverage Functions](https://util-functions.surge.sh/badge-functions.svg)
![Test Coverage Lines](https://util-functions.surge.sh/badge-lines.svg)
![Test Coverage Statements](https://util-functions.surge.sh/badge-statements.svg)

**156 test files · 693 tests** — all passing.

Should you like this project, please consider giving a ⭐ on GitHub.

## Contributors

| Contributor | GitHub | Role |
|------------|--------|------|
| <img src="https://avatars0.githubusercontent.com/u/27800340?s=40&v=4" width="32" height="32" /> | [Taimoor Khan](https://github.com/taimoormk) | Maintainer |

## Ecosystem

| Library | Storybook | npm |
|---------|-----------|-----|
| React Commons Collection | [storybook](https://react-commons-collection.surge.sh) | [npm](https://www.npmjs.com/package/@react-pakistan/react-commons-collection) |
| React UI Collection | [storybook](https://react-ui-collection.surge.sh) | [npm](https://www.npmjs.com/package/@react-pakistan/react-ui-collection) |
| React Icon Collection | [storybook](https://react-pakistan.github.io/react-icon-collection) | [npm](https://www.npmjs.com/package/@react-pakistan/react-icon-collection) |
| React Logo Collection | [storybook](https://react-pakistan.github.io/react-logo-collection) | [npm](https://www.npmjs.com/package/@react-pakistan/react-logo-collection) |
| React Emoji Collection | [storybook](https://react-pakistan.github.io/react-emoji-collection) | [npm](https://www.npmjs.com/package/@react-pakistan/react-emoji-collection) |
| React Native Commons Collection | [docs](https://react-pakistan.github.io/react-native-commons-collection) | [npm](https://www.npmjs.com/package/@react-pakistan/react-native-commons-collection) |
| React Native UI Collection | [docs](https://react-pakistan.github.io/react-native-ui-collection) | [npm](https://www.npmjs.com/package/@react-pakistan/react-native-ui-collection) |
| React Native Icon Collection | [docs](https://react-pakistan.github.io/react-native-icon-collection) | [npm](https://www.npmjs.com/package/@react-pakistan/react-native-icon-collection) |
| React Native Logo Collection | [docs](https://react-pakistan.github.io/react-native-logo-collection) | [npm](https://www.npmjs.com/package/@react-pakistan/react-native-logo-collection) |
| React Native Emoji Collection | [docs](https://react-pakistan.github.io/react-native-emoji-collection) | [npm](https://www.npmjs.com/package/@react-pakistan/react-native-emoji-collection) |

## Support

Join the community on [React Pakistan Slack](https://reactpakistan.slack.com).

**Contact** — [Taimoor Khan](https://taimoor.io) · [email](mailto:react.pakistan14@gmail.com)

---

<a href="https://www.buymeacoffee.com/60whp8FM3">
  <img src="https://bmc-cdn.nyc3.digitaloceanspaces.com/BMC-button-images/custom_images/yellow_img.png" alt="Buy Me A Coffee" width="180" />
</a>
