FIX 11.14.md

runtime error: index out of range when result len not enough
This commit is contained in:
Ding
2016-12-26 15:32:29 +08:00
committed by GitHub
parent e65ee42746
commit 4ec6a406d8

View File

@@ -162,7 +162,7 @@ func (cs Cars) FindAll(f func(car *Car) bool) Cars {
// Process cars and create new data. // Process cars and create new data.
func (cs Cars) Map(f func(car *Car) Any) []Any { func (cs Cars) Map(f func(car *Car) Any) []Any {
result := make([]Any, 0) result := make([]Any, len(cs))
ix := 0 ix := 0
cs.Process(func(c *Car) { cs.Process(func(c *Car) {
result[ix] = f(c) result[ix] = f(c)