mirror of
https://github.com/krawieck/lemmur/
synced 2024-12-15 18:10:53 +01:00
8 lines
205 B
Dart
8 lines
205 B
Dart
extension ExtraIterators<E> on Iterable<E> {
|
|
/// A `.map` but with an index as the second argument
|
|
Iterable<T> mapWithIndex<T>(T f(E e, int i)) {
|
|
var i = 0;
|
|
return map((e) => f(e, i++));
|
|
}
|
|
}
|