Commit cae093a

mo khan <mo@mokhan.ca>
2025-05-06 20:18:12
refactor: simplify usage of Configure[T]
1 parent 2ef1c0c
Changed files (2)
pkg
pkg/cookie/option.go
@@ -9,7 +9,7 @@ import (
 	"github.com/xlgmokha/x/pkg/x"
 )
 
-func With(with func(*http.Cookie)) x.Option[*http.Cookie] {
+func With(with x.Configure[*http.Cookie]) x.Option[*http.Cookie] {
 	return x.With[*http.Cookie](with)
 }
 
pkg/crypt/hmac.go
@@ -30,13 +30,13 @@ func (s *HMACSigner) Sign(data []byte) ([]byte, error) {
 }
 
 func WithAlgorithm(factory x.Factory[hash.Hash]) x.Option[*HMACSigner] {
-	return x.With[*HMACSigner](x.Configure[*HMACSigner](func(item *HMACSigner) {
+	return x.With[*HMACSigner](func(item *HMACSigner) {
 		item.factory = factory
-	}))
+	})
 }
 
 func WithKey(key []byte) x.Option[*HMACSigner] {
-	return x.With[*HMACSigner](x.Configure[*HMACSigner](func(item *HMACSigner) {
+	return x.With[*HMACSigner](func(item *HMACSigner) {
 		item.key = key
-	}))
+	})
 }