Files
rspade_system/node_modules/collect.js/docs/api/mapInto.md
root bd5809fdbd Reorganize RSpade directory structure for clarity
Improve Jqhtml_Integration.js documentation with hydration system explanation
Add jqhtml-laravel integration packages for traditional Laravel projects

🤖 Generated with [Claude Code](https://claude.com/claude-code)

Co-Authored-By: Claude <noreply@anthropic.com>
2025-11-24 09:41:48 +00:00

26 lines
528 B
Markdown

# `mapInto()`
The mapInto method iterates through the collection and instantiates the given class with each element as a constructor:
```js
const Player = function (name) {
this.name = name;
};
const collection = collect([
'Roberto Firmino',
'Darwin Núñez',
]);
const players = collection.mapInto(Player);
players.all();
// [
// Player { name: 'Roberto Firmino' },
// Player { name: 'Darwin Núñez' },
// ]
```
[View source on GitHub](https://github.com/ecrmnn/collect.js/blob/master/src/methods/mapInto.js)