Skip to content

Instantly share code, notes, and snippets.

@EvgenyArtemov
Created March 7, 2025 17:21
Show Gist options
  • Save EvgenyArtemov/a97ef0beb4571db01a65b7d4c6b02d84 to your computer and use it in GitHub Desktop.
Save EvgenyArtemov/a97ef0beb4571db01a65b7d4c6b02d84 to your computer and use it in GitHub Desktop.
const timeLimit = function(fn, t) {
let res;
return async function(...args) {
return new Promise((res, rej) => {
setTimeout(() => rej("Time Limit Exceeded"), t)
fn(...args).then(res, rej)
})
}
};
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment