You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
25 lines
570 B
25 lines
570 B
import type {Sequence} from './types';
|
|
|
|
interface ForEachTrait<K, V> {
|
|
forEach(callback: (value: V, key: K, self: this) => void): void;
|
|
}
|
|
|
|
interface PlainObject<T> {
|
|
[key: string]: T;
|
|
}
|
|
|
|
export default function forEach<K, V>(
|
|
iterable: ForEachTrait<K, V>,
|
|
callback: (value: V, key: K) => void
|
|
): void;
|
|
|
|
export default function forEach<T>(
|
|
iterable: Iterator<T> | Iterable<T> | Sequence<T>,
|
|
callback: (item: T, index: number) => void
|
|
): void;
|
|
|
|
export default function forEach<T>(
|
|
object: PlainObject<T>,
|
|
callback: (value: T, key: string) => void
|
|
): void;
|