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

Adds slice utils and val.Default() #14

Merged
merged 1 commit into from
Aug 30, 2022
Merged

Adds slice utils and val.Default() #14

merged 1 commit into from
Aug 30, 2022

Conversation

aidenwallis
Copy link
Owner

utils

  • utils.ValueAtIndex to fetch the value (or default) value at the index of a given slice. This is panic safe, and will return a bool as the second return value to indicate whether the value existed in the slice.
  • utils.IndexInSlice returns a boolean that indicates whether a value exists at a given index in a slice.

val

  • val.Default will return the default zero value for any given type parameter. This is just syntactical sugar on top of doing var v T

@aidenwallis aidenwallis self-assigned this Aug 30, 2022
@aidenwallis aidenwallis merged commit ae8fff4 into main Aug 30, 2022
@aidenwallis aidenwallis deleted the slice-utils branch August 30, 2022 12:17
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

Successfully merging this pull request may close these issues.

1 participant