feat: add static site generation functionality

This commit is contained in:
Evrard Van Espen
2025-10-30 10:00:54 +00:00
committed by Evrard Van Espen (aider)
parent 50412cb819
commit 08c64388cf
7 changed files with 628 additions and 0 deletions

19
utils.go Normal file
View File

@@ -0,0 +1,19 @@
package main
// filter filters a slice based on a predicate function.
// It returns a new slice containing only the elements for which the predicate returns true.
// Parameters:
// - s: The slice to filter.
// - predicate: The function to test each element of the slice.
//
// Returns:
// - A new slice containing the filtered elements.
func filter[T any](s []T, predicate func(T) bool) []T {
result := make([]T, 0, len(s)) // Pre-allocate for efficiency
for _, v := range s {
if predicate(v) {
result = append(result, v)
}
}
return result
}