
# Turnkey ID Utils Typescript

![TurnkeyID Logo](https://turnkey.id/assets/images/logo-black.png) <br/>
**Common utilities by TurnkeyID**

[![CI](https://github.com/turnkey-devs/utils-ts/actions/workflows/publish.yml/badge.svg)](https://github.com/turnkey-devs/utils-ts/actions/workflows/publish.yml.yml)
[![npm version](https://img.shields.io/npm/v/@turnkeyid/utils-ts.svg)](https://www.npmjs.com/package/@turnkeyid/utils-ts)
[![GPLv3 License](https://img.shields.io/badge/License-Apache_2.0-green.svg)](https://opensource.org/licenses/Apache-2.0)
[![codecov](https://codecov.io/gh/turnkey-devs/utils-ts/branch/main/graph/badge.svg?token=PODFO8ED4W)](https://codecov.io/gh/turnkey-devs/utils-ts)
[![changelog](https://img.shields.io/badge/CHANGELOG-grey.svg)](https://github.com/turnkey-devs/utils-ts/blob/main/CHANGELOG.md)

## Common Utilities

- Find
- Find with query (based on [sift](https://www.npmjs.com/package/sift))
- Typeguards
- Date Helpers
- Deepmerge (based on deepmerge-ts)
- EnvLoader
- Model Validator
- Zod Model Validator (based on [zod](https://www.npmjs.com/package/zod))
- Model Factory
- Normalize Float (precise calculation)
- Randomize / Generate UUID and ObjectID
- String Union Type
- AsyncAwaitMap / ParallelLimit (better parallelism handling)
- isEmpty (with typeguards)
- LoopingCertainTime (advanced setInterval with break point)
- Password Utility
- Currency Utility (based on [dinero.js](https://www.npmjs.com/package/dinero.js))
- ObjectRecurseImmutable (object nodes walker)
- RetryAsync
- TextFormatting (based on [mustache](https://www.npmjs.com/package/mustache))
- Measuring Performance Util
- Clone Immutable - to prevent any mutation of target object
- ...

## Utils

Most of utils won't work on web browser, since it's designed for backend usage.

- EasyFile (read, write)
- [PrettyLogger](./src/utils/logger/pretty_logger/README.md) <!-- !TODO: need documentation  -->
- EasyExcel <!-- !TODO: need documentation  -->
- SecureJWT - JWE Nodejs, easier approach than JOSE.
- [Configurator Util](./src/utils/configurator/README.md)
- LokiJS Database Repository Base <!-- !TODO: need documentation  -->
- MikroOrm Database Base Util
- typeorm Database Base Util (still in dev) <!-- !TODO: need documentation  -->
- Cache Util <!-- !TODO: need documentation  -->
- Dataloader Util <!-- !TODO: need documentation  -->
- Custom FP Approach HTTP Client Util (based on axios)

## Authors

- [@turnkey-dev](https://github.com/turnkey-devs)
- [@fatihaziz](https://github.com/fatihaziz)

## Support

For support, email <developer@turnkey.id> or join our [Discord Channel](https://discord.gg/6WVJgJv3fH)

or create issue on [repository](https://github.com/turnkey-devs/turnkey-api-proxy/issues)

## Build on

- NodeJS: 16.17.0
- TS: 4.9

## Compatibility Matrix

|                 | Typing  | Unit Test  | Status |
|:---             | :---:    |    :---:   |   ---: |
| Node v14        | ❌ | ❌ | unsupported|
| Node v16        | ❌ | ❌ | unsupported |
| Node v18        | ✅ | ✅ | OK |
| Node v20        | 🚀 | 🚀 | development |
| Typescript 4.5  | ❌ | ❌ | unsupported |
| Typescript 4.6  | ❌ | ❌ | unsupported |
| Typescript 4.7  | ❌ | ❌ | error |
| Typescript 4.8  | ✅ | ✅ | OK |
| Typescript 4.9  | ✅ | ✅ | OK |
| Typescript 5.0  | 🚀 | 🚀 | development |
| Typescript 5.1  | 🚀 | 🚀 | development |

## Web Browser Support

If you are using web browser or frontend purposes, please use `import webUtils from '@turnkeyid/utils-ts/web'` instead.
It may not have all the utils.

## Issue

If you find any issue, please create an issue on this repo.

## Changelog

[Changelog](https://github.com/turnkey-devs/utils-ts/blob/main/CHANGELOG.md)

### Show your support

Give a ⭐️ if this project helped you!
