Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Provide a lists module. #422

Open
cgrindel opened this issue Jan 5, 2023 · 0 comments
Open

Provide a lists module. #422

cgrindel opened this issue Jan 5, 2023 · 0 comments

Comments

@cgrindel
Copy link
Contributor

cgrindel commented Jan 5, 2023

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 a list, return a new list having removed the items that equal None.
  • contains: It has two modes.
    • Given a list and a bool function (i.e., accepts a single parameter and returns a bool), it will return True if any of the items in the list satisfy the function.
    • Given a list and any other type, it will return True if any of the items equal the input.
  • find: Given a list and a bool function, it will return the item that satisfies the function.
  • flatten: Given a list that may contain items that are list values, it returns a list with all of the items flattened (i.e., no items in the result are an item of type list).

If the code owners are agreeable, I am willing to put up one or more PRs.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant