Add Make method to Generator

This commit is contained in:
Dan Jones 2025-03-15 16:24:37 -05:00
commit 1008a064d0
2 changed files with 19 additions and 0 deletions

View file

@ -7,6 +7,12 @@ import "errors"
// for example.
type Generator func(conf *Config) (string, error)
// Make allows you to generate a new string directly from a generator.
func (g Generator) Make(opts ...Option) (string, error) {
opts = append(opts, WithGenerator(g))
return Make(NewConfig(opts...))
}
// WithGenerator sets the specified generator
func WithGenerator(g Generator) Option {
return func(c *Config) {