-
Couldn't load subscription status.
- Fork 0
initial commit, open source generic #1
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
Conversation
7974c1c to
3dd4589
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 11 out of 14 changed files in this pull request and generated no comments.
Files not reviewed (3)
- LICENSE: Language not supported
- Makefile: Language not supported
- go.mod: Language not supported
Comments suppressed due to low confidence (2)
slice.go:9
- [nitpick] The type parameter B is unconstrained, which may lead to unsafe conversions using B(a); consider constraining B (e.g., to ~string) if only string-like types are intended.
func CastStringySlice[B, A ~string | ~[]rune](orig []A) []B {
slice.go:85
- [nitpick] Consider renaming the variable 'new' to a more descriptive name (e.g., 'result') to avoid potential confusion with the built-in function new.
new := make([]T, 0, len(existing))
| return b | ||
| } | ||
| for k, v := range b { | ||
| a[k] = v |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
would it be important to document that if a has a value for k, that it would get overwritten by the value at k in b?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Done
| return c | ||
| } | ||
|
|
||
| func SliceContains[T any](slice []T, filter func(t T) bool) bool { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
not something for this PR probably, but I know there is a useful array function in JS called every that performs the filter and returns false if any of the elements does not satisfy the filter condition. Might be handy to include similar in this lib? It would look identical to this function but would be
if !filter(item) {
return false
}
// ...
return trueThere was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Maybe I'll even contribute a PR for this lol
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Copilot reviewed 13 out of 16 changed files in this pull request and generated no comments.
Files not reviewed (3)
- LICENSE: Language not supported
- Makefile: Language not supported
- go.mod: Language not supported
Comments suppressed due to low confidence (1)
slice.go:85
- [nitpick] The variable name 'new' shadows the built-in function and may lead to confusion. Consider renaming it to something more descriptive, such as 'result'.
new := make([]T, 0, len(existing))
No description provided.