Fixed prompt input to filter out 0x0D and 0x08 keystrokes
These can occur when pasting input with line-feeds.
This commit is contained in:
parent
46a430f58f
commit
7b194d0a19
2 changed files with 17 additions and 3 deletions
|
|
@ -7,3 +7,13 @@ func Map[T, U any](ts []T, fn func(t T) U) []U {
|
|||
}
|
||||
return us
|
||||
}
|
||||
|
||||
func Filter[T any](ts []T, fn func(t T) bool) []T {
|
||||
us := make([]T, 0)
|
||||
for _, t := range ts {
|
||||
if fn(t) {
|
||||
us = append(us, t)
|
||||
}
|
||||
}
|
||||
return us
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue