Skip to content

Conversation

@streamich
Copy link
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

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.

2 participants