open-index/open-npm huggingface dataset:
npm package: @hridel/convert-kit
Description: A library for converting colors between different formats (RGB, HSL, HEX).
Author: Ing. Jan Hridel
Latest version: 1.0.0

# Convert-kit

## ColorConverter

ColorConverter is a TypeScript library for converting colors between different formats, including RGB, Hexadecimal, and HSL.

### Installation

You can install the package using npm:

```sh
npm install @hridel/convert-kit
```

### Usage

#### Importing the Library

```typescript
import { ColorConverter } from '@hridel/convert-kit';
```

#### Converting RGB to Hex

```typescript
const hexColor = ColorConverter.rgbToHex(255, 0, 0);
console.log(hexColor); // Output: #ff0000
```

#### Converting Hex to RGB

```typescript
const rgbColor = ColorConverter.hexToRgb('#ff0000');
console.log(rgbColor); // Output: { r: 255, g: 0, b: 0 }
```

#### Converting RGB to HSL

```typescript
const hslColor = ColorConverter.rgbToHsl(255, 0, 0);
console.log(hslColor); // Output: { h: 0, s: 100, l: 50 }
```

#### Converting HSL to RGB

```typescript
const rgbColor = ColorConverter.hslToRgb(0, 100, 50);
console.log(rgbColor); // Output: { r: 255, g: 0, b: 0 }
```

### API

#### `ColorConverter.rgbToHex(r: number, g: number, b: number): string`

Converts RGB color values to a hexadecimal string.

- **r**: The red component of the color, an integer between 0 and 255.
- **g**: The green component of the color, an integer between 0 and 255.
- **b**: The blue component of the color, an integer between 0 and 255.

#### `ColorConverter.hexToRgb(hex: string): { r: number; g: number; b: number }`

Converts a hexadecimal string to RGB color values.

- **hex**: The hexadecimal string to convert.

#### `ColorConverter.rgbToHsl(r: number, g: number, b: number): { h: number; s: number; l: number }`

Converts RGB color values to the HSL format.

- **r**: The red component of the color, an integer between 0 and 255.
- **g**: The green component of the color, an integer between 0 and 255.
- **b**: The blue component of the color, an integer between 0 and 255.

#### `ColorConverter.hslToRgb(h: number, s: number, l: number): { r: number; g: number; b: number }`

Converts HSL color values to the RGB format.

- **h**: The hue of the color, a number between 0 and 360.
- **s**: The saturation of the color, a number between 0 and 100.
- **l**: The lightness of the color, a number between 0 and 100.

### License

This project is licensed under the Apache License 2.0.
npm package: @hridel/modulo
Description: A robust modular arithmetic utility for JavaScript, handling both positive and negative integers with ease. Ensure consistent, non-negative results for your modulo operations. Perfect for mathematical computations, circular buffer implementations, and mor
Author: Ing. Jan Hridel
Latest version: 1.2.0

# modulo

A robust modular arithmetic utility for JavaScript, handling both positive and negative integers with ease. Ensure consistent, non-negative results for your modulo operations. Perfect for mathematical computations, circular buffer implementations, and more.

## Installation

```bash
npm install @hridel/modulo
```

## `mod` function example

```javascript
import { mod } from '@hridel/modulo';

const exampleResult: number = mod(-1, 5);
console.log(`The result of -1 mod 5 is: ${exampleResult}`);  // The result of -1 mod 5 is: 4
```

## `rem` function example

```javascript
import { rem } from '@hridel/modulo';

// Example usage
const exampleResult: number = rem(-1, 5);
console.log(`The result of -1 rem 5 is: ${exampleResult}`);  // The result of -1 rem 5 is: -1
```

## `div` function example

```javascript
import { div } from '@hridel/modulo';

// Example usage
const exampleResult: number = div(-1, 5);
console.log(`The result of -1 div 5 is: ${exampleResult}`);  // The result of -1 div 5 is: -1
```

## Why to use this library?

Because `(-1 % 5)` in JavaScript returns `-1`, which is not a valid result for a **modulo** operation.

This library ensures that the result of the `mod` function is always a non-negative integer.

The `rem` function returns the remainder of the division operation, which can be negative.

And the `div` function returns the quotient rounded towards negative infinity, similar to Haskell's `div`.
npm package: @hridel/text-utils
Description: A collection of utility functions for text manipulation.
Author: Ing. Jan Hridel
Latest version: 1.2.0

# @hridel/text-utils

A collection of utility functions for text manipulation.

## Installation

```sh
npm install @hridel/text-utils
```

## Usage

```typescript
import { capitalize, capitalizeEachWord, slug, ascii } from '@hridel/text-utils';
```

### Functions

#### `capitalize`

Capitalize the first letter of a string.

**Parameters:**
- `text` (string): The input string.

**Returns:**
- (string): The capitalized string.

**Example:**

```typescript
import { capitalize } from '@hridel/text-utils';

console.log(capitalize('hello world')); // Output: 'Hello world'
```

#### `capitalizeEachWord`

Capitalize each word in a string.

**Parameters:**
- `text` (string): The input string.

**Returns:**
- (string): The string with each word capitalized.

**Example:**

```typescript
import { capitalizeEachWord } from '@hridel/text-utils';

console.log(capitalizeEachWord('hello world')); // Output: 'Hello World'
```

#### `slug`

Convert a string to a slug.

**Parameters:**
- `title` (string): The input string.
- `separator` (string, optional): The separator to use in the slug. Default is `'-'`.
- `dictionary` (object, optional): A dictionary of replacements. Default is `{'@': 'at'}`.

**Returns:**
- (string): The slugified string.

**Example:**

```typescript
import { slug } from '@hridel/text-utils';

console.log(slug('Hello World!')); // Output: 'hello-world'
console.log(slug('Hello@World', '_', {'@': 'at'})); // Output: 'hello_at_world'
```

#### `ascii`

Remove accents from a string.

**Parameters:**
- `text` (string): The input string.

**Returns:**
- (string): The string with accents removed.

**Example:**

```typescript
import { ascii } from '@hridel/text-utils';

console.log(ascii('café')); // Output: 'cafe'
```

### `stripHtmlTags`

Removes all HTML tags from the input string and returns plain text.

**Parameters:**
- `html` (string): The HTML string to be stripped of tags.

**Returns:**
- (string): The plain text without any HTML tags.

**Example:**

```typescript
import { stripHtmlTags } from '@hridel/text-utils';

console.log(stripHtmlTags('<p>Hello <strong>World</strong>!</p>')); // Output: 'Hello World!'
```


### `shortenText`

Shortens the given text to a specified maximum length, ensuring that words are not split.

**Parameters:**
- `text` (string): The text to be shortened.
- `maxLength` (number): The maximum length of the shortened text.
- `addEllipsis` (boolean, optional): Indicates whether to add ellipsis (…) at the end. Default is `true`.

**Returns:**
- (string): The shortened text.

**Example:**

```typescript
import { shortenText } from '@hridel/text-utils';

const originalText = "This is an example of a long sentence that needs to be shortened.";
const shortenedText = shortenText(originalText, 25);
console.log(shortenedText); // Output: "This is an example…"
```


## License

This project is licensed under the Apache-2.0 License.