File: options.go

package info (click to toggle)
golang-github-thoas-go-funk 0.9.3-1
  • links: PTS, VCS
  • area: main
  • in suites: bookworm, forky, sid, trixie
  • size: 504 kB
  • sloc: makefile: 10
file content (24 lines) | stat: -rw-r--r-- 361 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
package funk

type options struct {
	allowZero bool
}

type option func(*options)

func newOptions(values ...option) *options {
	opts := &options{
		allowZero: false,
	}
	for _, o := range values {
		o(opts)
	}
	return opts
}

// WithAllowZero allows zero values.
func WithAllowZero() func(*options) {
	return func(opts *options) {
		opts.allowZero = true
	}
}