#61 open
Yaffle

Enumerable#eachSlice docs incorrect

Reported by Yaffle | October 22nd, 2009 @ 01:29 PM

Enumerable#eachSlice iterator used to transform each slice (not each element) and example seems wrong.

var students = [
  { name: 'Sunny', age: 20 },
  { name: 'Audrey', age: 21 },
  { name: 'Matt', age: 20 },
  { name: 'Amelie', age: 26 },
  { name: 'Will', age: 21 }
];
 
// current
students.eachSlice(3, function(student) {
  return student.name;
});
// -> [], not [['Sunny', 'Audrey', 'Matt'], ['Amelie', 'Will']] as mentioned in docs

students = students.eachSlice(3, function(studentsSlice) {
  return studentsSlice.pluck('name');//student.name;
});
// -> [['Sunny', 'Audrey', 'Matt'], ['Amelie', 'Will']]

Comments and changes to this ticket

Please Sign in or create a free account to add a new ticket.

With your very own profile, you can contribute to projects, track your activity, watch tickets, receive and update tickets through your email and much more.

New-ticket Create new ticket

Create your profile

Help contribute to this project by taking a few moments to create your personal profile. Create your profile ยป

Shared Ticket Bins

Pages