summaryrefslogtreecommitdiff
path: root/pkg/x/option.go
diff options
context:
space:
mode:
Diffstat (limited to 'pkg/x/option.go')
-rw-r--r--pkg/x/option.go5
1 files changed, 4 insertions, 1 deletions
diff --git a/pkg/x/option.go b/pkg/x/option.go
index b0bf638..156e28c 100644
--- a/pkg/x/option.go
+++ b/pkg/x/option.go
@@ -5,7 +5,10 @@ type Option[T any] func(T) T
type Factory[T any] func() T
func New[T any](options ...Option[T]) T {
- item := Default[T]()
+ return NewWith[T](Default[T](), options...)
+}
+
+func NewWith[T any](item T, options ...Option[T]) T {
for _, option := range options {
item = option(item)
}