open-index/open-npm huggingface dataset:
npm package: @mypolis.eu/error
Description: [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
Author: Guilherme Rosado
Latest version: 0.1.6

# @mypolis.eu/error

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A TypeScript utility library for defining and asserting custom error types,
designed to work seamlessly with `@mypolis.eu/result`.

## Description

`@mypolis/error` provides a structured way to define specific error types
within your application. It includes a generic `Error` type and several common
aliases. Crucially, it offers assertion functions (`assertNoError` and
`assertError`) for testing purposes, allowing you to test if a value is an
error or not. This is particularly useful when working with the `Result` type
from `@mypolis.eu/result`.

## Installation

You can install `@mypolis.eu/error` using pnpm, npm, or yarn:

```bash
pnpm add @mypolis.eu/error @mypolis.eu/result

# or
npm install @mypolis.eu/error @mypolis.eu/result

# or
yarn add @mypolis.eu/error @mypolis.eu/result
```
npm package: @mypolis.eu/formdata
Description: A lightweight utility to process `FormData` into structured JavaScript objects. It supports nested objects and arrays using bracket notation, making it easier to handle complex form data.
Author: Guilherme Rosado
Latest version: 0.1.2

# @mypolis.eu/formdata

A lightweight utility to process `FormData` into structured JavaScript objects. It supports nested objects and arrays using bracket notation, making it easier to handle complex form data.

## Installation

```bash
pnpm add @mypolis.eu/formdata
```

Or using npm:

```bash
npm install @mypolis.eu/formdata
```

## Features

- **Nested Objects**: Supports keys like `user[name]` and `user[address][city]`.
- **Arrays**: Supports empty bracket notation (`items[]`), index notation (`items[0]`), and repeated keys.
- **Sparse Arrays**: Correctly handles sparse arrays (e.g., `items[0]` and `items[2]` will result in `[val1, undefined, val2]`).
- **Complex Structures**: Handles nested combinations of objects and arrays.
- **TypeScript Support**: Built with TypeScript for excellent developer experience.

## Usage

### Basic Example

```typescript
import { formDataToObject } from "@mypolis.eu/formdata";

const formData = new FormData();
formData.append("name", "John Doe");
formData.append("email", "john@example.com");

const result = formDataToObject(formData);
// { name: "John Doe", email: "john@example.com" }
```

### Nested Objects

```typescript
const formData = new FormData();
formData.append("user[name]", "John");
formData.append("user[address][city]", "Lisbon");

const result = formDataToObject(formData);
/*
{
  user: {
    name: "John",
    address: {
      city: "Lisbon"
    }
  }
}
*/
```

### Arrays

Supports multiple ways of defining arrays:

```typescript
const formData = new FormData();

// Index notation
formData.append("tags[0]", "news");
formData.append("tags[1]", "sport");

// Empty bracket notation
formData.append("categories[]", "tech");
formData.append("categories[]", "gadgets");

// Repeated names
formData.append("colors", "red");
formData.append("colors", "blue");

const result = formDataToObject(formData);
/*
{
  tags: ["news", "sport"],
  categories: ["tech", "gadgets"],
  colors: ["red", "blue"]
}
*/
```

### Complex Nested Structures

```typescript
const formData = new FormData();
formData.append("classes[0][name]", "10A");
formData.append("classes[0][students][0]", "Ana");
formData.append("classes[0][students][1]", "João");
formData.append("classes[1][name]", "11B");
formData.append("classes[1][students][0]", "Maria");

const result = formDataToObject(formData);
/*
{
  classes: [
    { name: "10A", students: ["Ana", "João"] },
    { name: "11B", students: ["Maria"] }
  ]
}
*/
```

## License

MIT
npm package: @mypolis.eu/result
Description: A simple, lightweight, and type-safe way to handle operations that can either succeed with a value or fail with an error, inspired by Rust's Result type. This package provides a `Result<T, E>` type and utility functions to work with it effectively in Type
Author: Guilherme Rosado
Latest version: 0.5.0

# @mypolis.eu/result

A simple, lightweight, and type-safe way to handle operations that can either
succeed with a value or fail with an error, inspired by Rust's Result type.
This package provides a `Result<T, E>` type and utility functions to work with it
effectively in TypeScript projects.

## Features

- **Type Safety**: Leverages TypeScript generics to ensure that success values
  and errors are handled correctly.

- **Explicit Error Handling**: Makes error handling more explicit and
  encourages a functional approach.

- **Simple API**: Includes functions like ok, err, wrap, wrapAsync, unwrap,
  map, mapErr, and match for ergonomic use.

- **Zero Dependencies**: Lightweight and adds no extra dependencies to your
  project.

## Installation

You can install the package using npm, yarn, or pnpm:

```bash
npm install @mypolis.eu/result
```

## Usage

First, import the necessary functions and types from the package:

```typescript
import { Result, ok, err, wrap, wrapAsync, unwrap, map, mapErr, match } from '@mypolis.eu/result';

// Creating Results
// Use ok(value) for successful outcomes and err(error) for failures.

function divide(a: number, b: number): Result<number, string> {
  if (b === 0) {
    return err("Division by zero is not allowed.");
  }
  return ok(a / b);
}

const successfulDivision = divide(10, 2); // { ok: true, value: 5, error: null }
const failedDivision = divide(10, 0);   // { ok: false, value: null, error: "Division by zero is not allowed." }
```

## Building

To build the package from source:

```bash
pnpm run build
```

This will compile the TypeScript code from src to JavaScript in the dist
directory and generate type declarations.

## Contributing

Contributions are welcome! Please feel free to submit issues and pull requests.
For major changes, please open an issue first to discuss what you would like to change.

## License

This project is licensed under the MIT License - see the LICENSE file for
details
npm package: @mypolis.eu/result-error
Description: [![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
Author: Guilherme Rosado
Latest version: 0.1.3
Deprecated: Package no longer supported. Contact Support at https://www.npmjs.com/support for more info.

# @mypolis.eu/result-error

[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)

A TypeScript utility library for defining and asserting custom error types,
designed to work seamlessly with `@mypolis.eu/result`.

## Description

`@mypolis/error` provides a structured way to define specific error types
within your application. It includes a generic `Error` type and several common
aliases. Crucially, it offers assertion functions (`assertNoError` and
`assertError`) for testing purposes, allowing you to test if a value is an
error or not. This is particularly useful when working with the `Result` type
from `@mypolis.eu/result`.

## Installation

You can install `@mypolis.eu/result-error` using pnpm, npm, or yarn:

```bash
pnpm add @mypolis.eu/result-error @mypolis.eu/result

# or
npm install @mypolis.eu/result-error @mypolis.eu/result

# or
yarn add @mypolis.eu/result-error @mypolis.eu/result
```