I have to say this is very unintuitive. In Nushell, you'd do:
ls | each { ... }
Another examples I don't need to explain, which would be far harder in stringly typed shells: ls | where type == file and size <= 5MiB | sort-by size | reverse | first 10
ps | where cpu > 10 and mem > 1GB | kill $in.pid
It's immediately obvious what you need to do when you can easily visualize your data: > ls
╭────┬───────────────────────┬──────┬───────────┬─────────────╮
│ # │ name │ type │ size │ modified │
├────┼───────────────────────┼──────┼───────────┼─────────────┤
│ 0 │ 404.html │ file │ 429 B │ 3 days ago │
│ 1 │ CONTRIBUTING.md │ file │ 955 B │ 8 mins ago │
│ 2 │ Gemfile │ file │ 1.1 KiB │ 3 days ago │
│ 3 │ Gemfile.lock │ file │ 6.9 KiB │ 3 days ago │
│ 4 │ LICENSE │ file │ 1.1 KiB │ 3 days ago │
│ 5 │ README.md │ file │ 213 B │ 3 days ago │
...