Make generatorFn more versatile

Pass the items array element as second parameter to generatorFn.