open-index/open-npm huggingface dataset:
npm package: @saez-juan/fetcher
Description: Wrapper seguro alrededor de `fetch` (Bun/WHATWG) que devuelve `Result` en vez de lanzar excepciones. Incluye helpers para parsear JSON, texto y para reenviar respuestas con el esquema de `Result`.
Latest version: 1.1.0

# @saez-juan/fetcher

Wrapper seguro alrededor de `fetch` (Bun/WHATWG) que devuelve `Result` en vez de lanzar excepciones. Incluye helpers para parsear JSON, texto y para reenviar respuestas con el esquema de `Result`.

---

## Instalacion

```bash
bun add @saez-juan/fetcher
```

## Idea principal

- `fetcher` envuelve `fetch` y devuelve `Result` para modelar exito/error como valores.
- Evita excepciones en el flujo normal y promueve manejo explicito de errores.
- Helpers incluidos: `fetcher.json`, `fetcher.text`, `fetcher.forward`.

## API

- `fetcher(input, init?) => AsyncResult<Response>`
- `fetcher.json<T>(input, init?) => AsyncResult<T>`
- `fetcher.text(input, init?) => AsyncResult<string>`
- `fetcher.forward<T>(input, init?) => AsyncResult<T>`

Notas:

- `init.fetch?: (typeof fetch)` permite inyectar tu propia implementacion (util en tests).
- `init.headers` admite `Record<string, string>` o un diccionario tipado.

## Uso basico

```ts
import fetcher from "@saez-juan/fetcher";

// Realiza una request y maneja el resultado sin excepciones
const res = await fetcher("https://api.example.com/ping");
if (res.isErr) {
	console.error(res.error);
	return;
}

const response = res.value;
console.log("status:", response.status);
```

## JSON helper

```ts
import fetcher from "@saez-juan/fetcher";

type Ping = { ok: boolean };

const res = await fetcher.json<Ping>("https://api.example.com/ping");
if (res.isErr) {
	return console.error(res.error);
}

console.log("ok:", res.value.ok);
```

## Text helper

```ts
import fetcher from "@saez-juan/fetcher";

const res = await fetcher.text("https://example.com/robots.txt");
if (res.isErr) return console.error(res.error);

console.log(res.value);
```

## Forward helper (reenviar `Result`)

```ts
import fetcher from "@saez-juan/fetcher";

// Espera un body con forma { success: boolean; data?: unknown; error?: ResultError }
const res = await fetcher.forward<number>(
	"https://api.example.com/price?id=SKU123"
);
if (res.isErr) {
	return console.error(res.error);
}

console.log("price:", res.value);
```

## Inyeccion de `fetch` (tests y entornos)

```ts
import fetcher from "@saez-juan/fetcher";

const res = await fetcher("/endpoint", {
	fetch: (input, init) => {
		return Promise.resolve(new Response(JSON.stringify({ ok: true })));
	}
});

if (res.isOk) {
	console.log(await res.value.json());
}
```

---

_Hecho por Juan Saez_
npm package: @saez-juan/result
Description: Pequena utilidad para modelar resultados de operaciones con el patron "error-as-values", inspirada en `Result` de Rust. Evita excepciones para el flujo normal y hace explicito el manejo de errores.
Latest version: 1.1.0

# @saez-juan/result

Pequena utilidad para modelar resultados de operaciones con el patron "error-as-values", inspirada en `Result` de Rust. Evita excepciones para el flujo normal y hace explicito el manejo de errores.

## Instalacion

```bash
bun add @saez-juan/result
```

## Idea principal

En vez de lanzar excepciones, las funciones retornan un objeto `Result` que puede ser:

- `ok(data)`: operacion exitosa con `data`.
- `err({ code, message?, details? })`: operacion fallida con informacion del error.

## Uso basico

```ts
import Result from "@saez-juan/result";

function divide(a: number, b: number) {
	if (b === 0)
		return Result.err({
			code: "DIV_BY_ZERO",
			message: "Cannot divide by zero"
		});
	return Result.ok(a / b);
}

const r = divide(6, 3);
if (r.isOk) {
	console.log("result:", r.value);
} else {
	console.error("error:", r.error);
}
```

## API

Tipos exportados:

- `ResultError`: `{ code: string; message?: string; details?: unknown }`
- `SyncResult<T>`: alias de `Result<T> | ErrorResult`
- `AsyncResult<T>`: alias de `Promise<Result<T> | ErrorResult>`
- `ErrorResult`: alias de `Result<null>`

Clase `Result<T>`:

- Propiedades de solo lectura:
    - `isOk: boolean` -- indica exito
    - `isErr: boolean` -- indica error
    - `value: NonNullable<T>` -- datos cuando `isOk` es `true`
    - `error: ResultError` -- error cuando `isErr` es `true`
    - `asError: ErrorResult` -- mismo objeto, tipado como `Result<null>`, limpia `data`
- Metodos estaticos:
    - `Result.ok<D>(data: D): Result<D>`
    - `Result.err(err: ResultError): ErrorResult`
- Metodos de instancia:
    - `clear(scope?: "data" | "error" | "all"): void` -- elimina campos internos para sanitizar respuestas

Nota: evita construir `Result` con `new`. Usa `Result.ok` y `Result.err`.

## Ejemplos practicos

Manejo de errores temprano:

```ts
const res = await getUser();
if (res.isErr) return res.asError; // propaga error con tipo seguro

const user = res.value;
```

Encadenado y sanitizacion:

```ts
const r = await createOrder(input);
if (r.isErr) return r.asError;

// Limpiar error antes de responder publicamente
r.clear("error");
return r; // solo contiene data
```

Uso con `AsyncResult`:

```ts
import type { AsyncResult } from "@saez-juan/result";

async function getPrice(id: string): AsyncResult<number> {
	try {
		const price = await service.prices.get(id);
		return Result.ok(price);
	} catch (e) {
		return Result.err({ code: "REMOTE_ERROR", details: e });
	}
}
```

## Buenas practicas

- Valida `isOk`/`isErr` antes de acceder a `value`/`error`.
- Usa `asError` para burbujear errores sin perder tipo.
- Utiliza `clear` para remover `data` o `error` al construir respuestas externas.

---

_Hecho por Juan Saez_
npm package: @safad-srmg/my-library
Description: This library is made by a Button.
Author: Safad
Latest version: 0.1.0

# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).
npm package: @safad-srmg/ui
Description: This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).
Latest version: 0.1.1

# Getting Started with Create React App

This project was bootstrapped with [Create React App](https://github.com/facebook/create-react-app).

## Available Scripts

In the project directory, you can run:

### `npm start`

Runs the app in the development mode.\
Open [http://localhost:3000](http://localhost:3000) to view it in the browser.

The page will reload if you make edits.\
You will also see any lint errors in the console.

### `npm test`

Launches the test runner in the interactive watch mode.\
See the section about [running tests](https://facebook.github.io/create-react-app/docs/running-tests) for more information.

### `npm run build`

Builds the app for production to the `build` folder.\
It correctly bundles React in production mode and optimizes the build for the best performance.

The build is minified and the filenames include the hashes.\
Your app is ready to be deployed!

See the section about [deployment](https://facebook.github.io/create-react-app/docs/deployment) for more information.

### `npm run eject`

**Note: this is a one-way operation. Once you `eject`, you can’t go back!**

If you aren’t satisfied with the build tool and configuration choices, you can `eject` at any time. This command will remove the single build dependency from your project.

Instead, it will copy all the configuration files and the transitive dependencies (webpack, Babel, ESLint, etc) right into your project so you have full control over them. All of the commands except `eject` will still work, but they will point to the copied scripts so you can tweak them. At this point you’re on your own.

You don’t have to ever use `eject`. The curated feature set is suitable for small and middle deployments, and you shouldn’t feel obligated to use this feature. However we understand that this tool wouldn’t be useful if you couldn’t customize it when you are ready for it.

## Learn More

You can learn more in the [Create React App documentation](https://facebook.github.io/create-react-app/docs/getting-started).

To learn React, check out the [React documentation](https://reactjs.org/).