Skip to content

Structured random#1

Merged
streamich merged 11 commits intomasterfrom
structured-random
Aug 3, 2025
Merged

Structured random#1
streamich merged 11 commits intomasterfrom
structured-random

Conversation

@streamich
Copy link
Copy Markdown
Collaborator

No description provided.

Specifies all templates for generating structured JSON data.

```ts
export type Template =
  | LiteralTemplate
  | NumberTemplate
  | IntegerTemplate
  | FloatTemplate
  | StringTemplate
  | BooleanTemplate
  | NullTemplate
  | ArrayTemplate
  | ObjectTemplate
  | OrTemplate;
```
Example:

```ts
const str = TemplateJson.gen(['str', ['pick', ['foo', 'bar', 'baz']]]);
```
Example:

```ts
const int = TemplateJson.gen(['int', -10, 10])
```
- Add MapTemplate type to TemplateNode union and TemplateShorthand
- Implement generateMap method in TemplateJson class
- Handle 'map' shorthand in generate method
- Support custom key tokens, value templates, and min/max constraints
- Respect maxNodes limit for map generation
- Add comprehensive test suite covering all map functionality
- Add demo showcasing various map use cases
- Fix import type declarations for better tree-shaking
@streamich streamich merged commit 49e341a into master Aug 3, 2025
2 checks passed
@streamich streamich deleted the structured-random branch August 3, 2025 11:35
@github-actions
Copy link
Copy Markdown

github-actions Bot commented Aug 3, 2025

🎉 This PR is included in version 1.0.0 🎉

The release is available on:

Your semantic-release bot 📦🚀

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant