# @fabryscript/algorithms

> ![License](https://img.shields.io/badge/license-MIT-blue)

Latest version **0.0.3** (published 2023-10-30) · MIT license · 0 weekly downloads

## Install

```sh
npm install @fabryscript/algorithms
pnpm add @fabryscript/algorithms
yarn add @fabryscript/algorithms
bun add @fabryscript/algorithms
```

## Health

**Score 25/100 (F)** — status: abandoned.

Positive: has types; esm support; no vulnerabilities.

Warnings: low downloads; pre 1.0.

Negative: abandoned; low maintenance score.

## Facts

| | |
|---|---|
| Version | 0.0.3 |
| Published | 2023-10-30 |
| First published | 2023-10-30 |
| Weekly downloads | 0 |
| License | MIT |
| TypeScript types | bundled |
| Module format | ESM + CommonJS |
| Dependencies | 0 |
| Unpacked size | 5.4 KB |
| Known vulnerabilities | 0 |
| Install scripts | no |
| GitHub stars | 0 |
| Maintainers | fabryscript |
| Keywords | utilities, alchemical, algorithms, objects, keys |

## Links

- npm: https://www.npmjs.com/package/@fabryscript/algorithms
- Repository: https://github.com/fabryscript/alchemical
- Homepage: https://github.com/fabryscript/alchemical#readme
- Issues: https://github.com/fabryscript/alchemical/issues
- npm.io page: https://npm.io/package/@fabryscript/algorithms

## Recent versions

- 0.0.3 (latest) — 2023-10-30
- 0.0.2 — 2023-10-30
- 0.0.1 — 2023-10-30

## README

# Algorithms

![License](https://img.shields.io/badge/license-MIT-blue)

A collection of utility functions and algorithms for various programming tasks.

## Installation

You can install the `@fabryscript/algorithms` library using npm or yarn:

```bash
npm install @fabryscript/algorithms
# or
yarn add @fabryscript/algorithms
```

## Usage

Import the functions you need from the library and use them in your code.

### `transformKeys<T>(o: Record<string, T>, transformCallback: (originalKey: string) => string | Promise<string>): Record<string, T> | Promise<Record<string, T>>`

Transform an object's keys based on a provided callback function, which can be either synchronous or asynchronous.

**Parameters:**

- `o` (Required): The object to be operated on.
- `transformCallback` (Required): The callback function that transforms each key. It must return a string as the keys are expected to be strings. This callback can be either synchronous or asynchronous.

**Returns:**

- A new object with transformed keys. If the `transformCallback` is asynchronous, it returns a promise that resolves to the new object.

**Example:**

```javascript
import { transformKeys } from "@fabryscript/algorithms"

const inputObject = { name: 'John', age: 30 };
const asyncTransformCallback = async (key) => key.toUpperCase();
const transformedObject = await transformKeys(inputObject, asyncTransformCallback);
console.log(transformedObject);
// Output: { NAME: 'John', AGE: 30 }
```

## License

This library is open-source and available under the [MIT License](LICENSE).

---
_Source: https://npm.io/package/@fabryscript/algorithms · Machine-readable twin of the npm.io package page. Health data is recomputed on every publish._
