Categorygithub.com/nicjohnson145/hlp
modulepackage
0.7.0
Repository: https://github.com/nicjohnson145/hlp.git
Documentation: pkg.go.dev

# README

hlp

Generic h(e)lp(ers)

This is a sort of half-fork of the absolutely awesome samber/lo. My only issue was the lack of "error" variants in the slices helpers, even though lots of issues/PRs seem to have been raised to introduce them.

For a complete list of included functions, see the godoc.

# Packages

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author

# Functions

Assign merges multiple maps from left to right.
Batch "chunks" an array into the arrays of the specified size Shamelessly stolen from https://go.dev/wiki/SliceTricks.
No description provided by the author
DefaultEnv tries to look up an environment variable, returning the value if set, or defaultVal if not set.
ExtractNamedMatches converts the array returned by `regexp.FindStringSubmatch` into a map, whose keys are the capture group names, and whose values are the results.
ExtractRange creates a new list with the elements from list, as specified by the range expression.
Fill creates an array of length `count` filled with the supplied value.
FillFunc creates an array of length `count` using the return value of the supplied generation function.
Filter returns all elements of the input slice the supplied callback returns true for.
FilterErr is like Filter, but the callback function can fail.
FilterMap is the combination of Filter & Map, returning the elements from the input slice as transformed by the callback function, but only in cases where the callback function also returns true.
FilterMapErr is like FilterMap, but the callback function can fail.
Flatten consolidates multiple lists into a single conjoined list.
No description provided by the author
Invert swaps keys & values for the given map.
Keys creates an slice of the map keys.
Map returns all elements of the input slice as transformed by the supplied callback function.
MapErr is like Map, but the callback function can fail.
MapFromSlice returns a map, whose keys & values are the return values from applying the callback function to each element of the given slice.
MapFromSliceErr is like MapFromSlice, but the callback function can fail.
Must wraps a function call that returns value and error, and panics if the error is non-nil.
ParseRange parses the given range expression within the context of the supplied total length.
Ptr returns a pointer copy of the given value.
Ternary is returns the first argument if condition is true, otherwise returns the second argument.
ToAnySlice returns a new slice where all elements of `collection` are mapped to the `any` type.
Values creates an slice of the map values.

# Variables

No description provided by the author
No description provided by the author
No description provided by the author
No description provided by the author