Skip to content

Instantly share code, notes, and snippets.

@rasmusmerzin
Created July 2, 2026 07:36
Show Gist options
  • Select an option

  • Save rasmusmerzin/fb93169b4d282ab43f3674efcd379e8e to your computer and use it in GitHub Desktop.

Select an option

Save rasmusmerzin/fb93169b4d282ab43f3674efcd379e8e to your computer and use it in GitHub Desktop.
export function loopFunction<S, T>(
fn: (this: S, item: T) => any,
): (this: S, ...items: T[]) => void {
return function (this: S, ...items: T[]) {
for (const item of items) {
try {
fn.call(this, item);
} catch (e) {}
}
};
}
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment