variadic

package
v0.12.2 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jun 29, 2022 License: BSD-3-Clause, MIT, MIT-0, + 1 more Imports: 1 Imported by: 0

README

variadic - helpers for variadic functions

go get -u "tawesoft.co.uk/go"
import "tawesoft.co.uk/go/variadic"
Links License Stable?
homedocssrc MIT candidate

About

Package variadic implements features that make it easier to work with variadic functions.

Getting Help

This package is part of tawesoft.co.uk/go, a monorepo for small Go modules maintained by Tawesoft®. Check out that URL for more information about other Go modules from Tawesoft plus community and commercial support options.

Documentation

Overview

Package variadic implements features that make it easier to work with variadic functions.

Package Information

License: MIT (see LICENSE.txt)

Stable: candidate

For more information, documentation, source code, examples, support, links, etc. please see https://www.tawesoft.co.uk/go and https://www.tawesoft.co.uk/go/variadic

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Flatten

func Flatten(args ...interface{}) []interface{}

Flatten takes a variable number of arguments and returns an array containing, in sequence, each argument or - if an argument is an array or a slice - that argument's contents.

e.g. Flatten(1, []int{2, 3, 4}, 5) => 1, 2, 3, 4, 5

func FlattenExcludingNils

func FlattenExcludingNils(args ...interface{}) []interface{}

FlattenExcludingNils takes a variable number of arguments and returns an array containing, in sequence, each non-nil argument or - if an argument is an array or a slice - that argument's non-nil contents.

e.g. FlattenExcludingNils(1, nil, []int{2, nil, 3, 4}, 5) => 1, 2, 3, 4, 5

func FlattenRecursive

func FlattenRecursive(args ...interface{}) []interface{}

FlattenRecursive takes a variable number of arguments and returns an array containing, in sequence, each argument or - if an argument is an array or a slice - that argument's contents, flattened recursively.

e.g. FlattenRecursive([]interface{}{1, 2, []int{3, 4}}, 5) => 1, 2, 3, 4, 5

Types

This section is empty.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL