summaryrefslogtreecommitdiff
path: root/pkg/x/option.go
diff options
context:
space:
mode:
authormo khan <mo@mokhan.ca>2025-07-30 10:51:05 -0600
committermo khan <mo@mokhan.ca>2025-07-30 10:51:05 -0600
commit1a2af5f242cffaf59c457c847dff716b600ab342 (patch)
tree4e20b9f5b5fdd293e455b4cab1c083491f0d94a4 /pkg/x/option.go
parentf79ef71d5cac3b396808edc4dacdf654d65468c2 (diff)
feat: add x.NewWithmain
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)
}