bazel-skylib
bazel-skylib copied to clipboard
Provide a `lists` module.
I have a Starlark lists
module with several functions that make working with list
values a little eaiser. I am willing to contribute it to bazel-skylib
as the functionality seems generally useful.
Current functions:
-
compact
: Given alist
, return a newlist
having removed the items that equalNone
. -
contains
: It has two modes.- Given a
list
and abool
function (i.e., accepts a single parameter and returns abool
), it will returnTrue
if any of the items in the list satisfy the function. - Given a
list
and any other type, it will returnTrue
if any of the items equal the input.
- Given a
-
find
: Given a list and abool
function, it will return the item that satisfies the function. -
flatten
: Given alist
that may contain items that arelist
values, it returns alist
with all of the items flattened (i.e., no items in the result are an item of typelist
).
If the code owners are agreeable, I am willing to put up one or more PRs.