// First is exposed to templates, to iterate over the first N items in a
// rangeable list.
func First(limit interface{}, seq interface{}) (interface{}, error) {
+
+ if limit == nil || seq == nil {
+ return nil, errors.New("both limit and seq must be provided")
+ }
+
limitv, err := cast.ToIntE(limit)
if err != nil {
{"1", []int{100, 200, 300}, []int{100}},
{int64(-1), []int{100, 200, 300}, false},
{"noint", []int{100, 200, 300}, false},
+ {1, nil, false},
+ {nil, []int{100}, false},
+ {1, t, false},
} {
results, err := First(this.count, this.sequence)
if b, ok := this.expect.(bool); ok && !b {