Codibre/fluent-iterable

View on GitHub
src/sync/for-each.ts

Summary

Maintainability
A
0 mins
Test Coverage
A
100%
export function forEach<T>(this: Iterable<T>, mapper: any) {
  const iterator = this[Symbol.iterator]();
  let item: IteratorResult<T>;
  while (!(item = iterator.next()).done) mapper(item.value);
}