Dashboard sipadu mbip
Du kannst nicht mehr als 25 Themen auswählen Themen müssen mit entweder einem Buchstaben oder einer Ziffer beginnen. Sie können Bindestriche („-“) enthalten und bis zu 35 Zeichen lang sein.

mapInto.md 514B

mapInto()

The mapInto method iterates through the collection and instantiates the given class with each element as a constructor:

const Player = function (name) {
  this.name = name;
};

const collection = collect(['Roberto Firmino', 'Sadio Mané']);

const players = collection.mapInto(Player);

players.all();

// [
//   Player { name: 'Roberto Firmino' },
//   Player { name: 'Sadio Mané' },
// ]

View source on GitHub