exclude openssl and i18n from npm run format; + npm run format (#183)

This commit is contained in:
Aleksandr Iushmanov
2025-04-27 14:43:16 +01:00
committed by GitHub
parent b841469505
commit ccfb09e261
12 changed files with 31 additions and 30 deletions

View File

@@ -5,23 +5,24 @@
*
* I could use _.debounce(), but bringing dependency on lodash didn't feel
* justified yet.
*
*
* @param func The function to debounce
* @param wait The number of milliseconds to delay execution
* @returns A debounced version of the provided function
*/
function debounce<T extends (...args: any[]) => void>(
func: T,
wait: number
wait: number,
): T & { cancel: () => void } {
let timeout: ReturnType<typeof setTimeout> | null = null;
const debounced = function(
this: ThisParameterType<T>, ...args: Parameters<T>
const debounced = function (
this: ThisParameterType<T>,
...args: Parameters<T>
): void {
const context = this;
const later = function() {
const later = function () {
timeout = null;
func.apply(context, args);
};
@@ -33,7 +34,7 @@ function debounce<T extends (...args: any[]) => void>(
timeout = setTimeout(later, wait);
};
debounced.cancel = function() {
debounced.cancel = function () {
if (timeout) {
clearTimeout(timeout);
timeout = null;
@@ -43,4 +44,4 @@ function debounce<T extends (...args: any[]) => void>(
return debounced as T & { cancel: () => void };
}
export default debounce;
export default debounce;