open-index/open-npm huggingface dataset:
npm package: @neram-models/base
Description: Collection of abstract base models
Author: Andriyan Ivanov
Latest version: 1.0.0

# Base models

Collection of abstract base models

## TimestampableEntity (abstract)

Adds the following properties to a model and sets them automatically

| Property  | Type |
| --------- | ---- |
| id        | uuid |
| createdAt | Date |
| updatedAt | Date |

## How to use

```js
import { TimestampableEntity } from '@neram-models/base';

class MyModel extends TimestampableEntity {}
```
npm package: @nerd-bible/fonts
Description: Font build pipeline.
Latest version: 0.1.0

# fonts

Font build pipeline.

## Goals
- [x] Cover ALL languages in unicode (iOS, macOS, Android, and Windows sadly don't)
- [x] Consistent look and feel
- [x] Subset megafonts and compress to WOFF2 for fast initial loads
- [ ] Static site frontend viewer similar to
[FontDrop](https://fontdrop.info) or
[Wakamai Fondue](https://wakamaifondue.com) with a unicode page map to see
coverage and demo fonts.

## Coverage
### Font family
Noto supports the largest amount of unicode with a consistent look and feel.

I tried serif designs for the main body text. While they look fancy and feel
formal, they're slower to read. They're also not available for a large number
of minority languages. Oh, and they double the app size.

For that reason we'll use sans-serif fonts.

### Variable axes
Variable font weights are about double the size of regular fonts. Additionally,
they may change _any_ part of the layout of fonts. I don't want user highlights
to change the text layout because that's not what happens in real life!

For that reason we'll rely on the browser's font synthesis which does not
affect layout.

## Adding a font
Confirm redistrubution is allowed and then add to ./src/download.ts.

## Why not in monorepo?
Anything that requires a download step (outside of `npm i` or `cargo install`)
to build should not be in the monorepo because postinstall steps are icky.
npm package: @nerd-bible/valio
Description: Encode and decode Typescript types with extensible error handling.
Latest version: 0.1.18

# valio

Encode and decode Typescript types with extensible error handling.

## Why?

I like [Zod](https://zod.dev), but its codecs don't support
[custom error contexts.](https://github.com/colinhacks/zod/issues/) I tried
adding support to Zod but found it easier to start from scratch.

## Theory

- Data flows through "pipes" with specific input and output types.
  - Both input and output are validated
- Pipes are bidirectional.
  - Input -> output is "decoding"
  - Output -> input is "encoding"
- When encoding or decoding a `Context` is passed which holds:
  - The path to the current value
  - Error formatting function
  - Errors grouped by path

## Practice

Use classes, inheritance, and result types. No errors are thrown.

### Usage

For primitive types the input and output are the same.

```ts
import * as v from "@nerd-bible/valio";

const schema = v.number(); // Pipe<number, number>

expect(schema.decode(5)).toEqual({ success: true, output: 5 });
expect(schema.decodeAny("5")).toEqual({
	success: false,
	errors: { ".": [{ input: "5", message: "not type number" }] },
});
```

You can add custom checks, but be sure to provide context for error messages.

```ts
import * as v from "@nerd-bible/valio";

const schema = v.number().refine((n) => n == 5, "eq", { n: 5 });

expect(schema.decode(5)).toEqual({ success: true, output: 5 });
expect(schema.encode(3)).toEqual({
	success: false,
	errors: { ".": [{ input: 3, message: "must be 5" }] },
});
```

There are common builtin codecs for coercion.

```ts
import * as v from "@nerd-bible/valio";

const schema = v.codecs.number();

expect(schema.decode("13")).toEqual({ success: true, output: 13 });
```

### Extending

To make a codec with a custom transformer, you can use `v.codecs.custom`.

```ts
import * as v from "@nerd-bible/valio";

function transformToNumber(any: number): number {
	if (typeof any == "number") return any;
	return NaN;
}

const schema = v.codecs.custom(
	v.union([v.string(), v.number(), v.null(), v.undefined()]),
	v.number(),
	{ decode: transformToNumber },
);
```

To make a pipe with any types and transformers, simply extend the class with
your input and output `HalfPipe`s.

```ts
import { Pipe, HalfPipe } from "@nerd-bible/valio";

function transformToNumber(any: number): number {
	if (typeof any == "number") return any;
	return NaN;
}

class AnyToNumber extends Pipe<any, number> {
	constructor() {
		super(
			new HalfPipe("any", (v): v is any => true, transformToNumber),
			new HalfPipe("number", (v): v is number => typeof v == "number"),
		);
	}
}
```

### Custom error messages

Override `errorFmt` in `Context` and pass it to `encode` and `decode`.

```ts
import * as v from "@nerd-bible/valio";

const schema = v.number().refine((n) => n == 5, "eq", { n: 5 });
class MyContext extends v.Context {
	errorFmt() {
		return "You done messed up";
	}
}

expect(schema.decode(3, new MyContext())).toEqual({
	success: false,
	errors: { ".": [{ input: 3, message: "You done messed up" }] },
});
```