Skip to content

Conversation

@muir
Copy link
Collaborator

@muir muir commented Apr 7, 2025

No description provided.

@muir muir force-pushed the initial branch 2 times, most recently from 7974c1c to 3dd4589 Compare April 8, 2025 18:23
@muir muir requested a review from Copilot April 8, 2025 18:25
Copy link

Copilot AI left a 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))

@muir muir requested review from dncohen and mitchwadair April 8, 2025 18:26
return b
}
for k, v := range b {
a[k] = v
Copy link
Collaborator

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?

Copy link
Collaborator Author

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 {
Copy link
Collaborator

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 true

Copy link
Collaborator

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

@muir muir requested a review from Copilot April 8, 2025 19:32
Copy link

Copilot AI left a 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))

@muir muir merged commit a19eb7a into main Apr 8, 2025
27 of 28 checks passed
@muir muir deleted the initial branch April 8, 2025 19:36
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.

3 participants