diff options
author | Markus Wüstenberg | 2022-09-22 09:41:06 +0200 |
---|---|---|
committer | GitHub | 2022-09-22 09:41:06 +0200 |
commit | f387a7123040d9414350bf783bdeff17ac0572c7 (patch) | |
tree | 89859a54e3cd6bf3e6169c384529af98aeee4dc5 /gomponents.go | |
parent | 3334d6c7d049cec57ad36f9d5cb0d491faf54a5d (diff) | |
download | gomponents-f387a7123040d9414350bf783bdeff17ac0572c7.tar.lz gomponents-f387a7123040d9414350bf783bdeff17ac0572c7.tar.zst gomponents-f387a7123040d9414350bf783bdeff17ac0572c7.zip |
Add generic Map implementation (#108)
Instead of waiting for a good time to switch the `Map` implementation, I've decided to just offer two implementations: one for Go versions before 1.18, and one for 1.18 and onwards. This is achieved using build tags in the source files. This is obviously a breaking change for consumers of this library that use Go 1.18 and onwards. See #88
Diffstat (limited to 'gomponents.go')
-rw-r--r-- | gomponents.go | 9 |
1 files changed, 0 insertions, 9 deletions
diff --git a/gomponents.go b/gomponents.go index a97691e..ddc3cc3 100644 --- a/gomponents.go +++ b/gomponents.go @@ -244,15 +244,6 @@ func Group(children []Node) Node { return group{children: children} } -// Map something enumerable to a list of Nodes. -func Map(length int, cb func(i int) Node) []Node { - var nodes []Node - for i := 0; i < length; i++ { - nodes = append(nodes, cb(i)) - } - return nodes -} - // If condition is true, return the given Node. Otherwise, return nil. // This helper function is good for inlining elements conditionally. func If(condition bool, n Node) Node { |