✨ Config.AddOptions and Generator.MakeWithConfig
This commit is contained in:
parent
d7b14f804c
commit
1abfaa44d1
3 changed files with 25 additions and 3 deletions
|
|
@ -10,10 +10,15 @@ import (
|
|||
// for example.
|
||||
type Generator func(conf *Config) (string, error)
|
||||
|
||||
// Make allows you to generate a new string directly from a generator.
|
||||
// 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...))
|
||||
return g.MakeWithConfig(NewConfig(opts...))
|
||||
}
|
||||
|
||||
// MakeWithConfig allows you to generate a new string directly from a Generator
|
||||
// with a pre-existing Config.
|
||||
func (g Generator) MakeWithConfig(c Config) (string, error) {
|
||||
return Make(c.AddOptions(WithGenerator(g)))
|
||||
}
|
||||
|
||||
// WithGenerator sets the specified generator
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue