...

Source file src/github.com/thoas/go-funk/options.go

Documentation: github.com/thoas/go-funk

     1  package funk
     2  
     3  type options struct {
     4  	allowZero bool
     5  }
     6  
     7  type option func(*options)
     8  
     9  func newOptions(values ...option) *options {
    10  	opts := &options{
    11  		allowZero: false,
    12  	}
    13  	for _, o := range values {
    14  		o(opts)
    15  	}
    16  	return opts
    17  }
    18  
    19  // WithAllowZero allows zero values.
    20  func WithAllowZero() func(*options) {
    21  	return func(opts *options) {
    22  		opts.allowZero = true
    23  	}
    24  }
    25  

View as plain text