diff --git a/src/common/utils.ts b/src/common/utils.ts index 1f4341578..157cf5092 100644 --- a/src/common/utils.ts +++ b/src/common/utils.ts @@ -1,6 +1,7 @@ // regex match the semver (semantic version) this checks for the pattern X.Y.Z // ex-valid v1.2.0, 1.2.0, 2.3.4-r51 -const semver = /^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)?)?$/i; +const semver = + /^v?(?:\d+)(\.(?:[x*]|\d+)(\.(?:[x*]|\d+)(?:-[\da-z-]+(?:\.[\da-z-]+)*)?(?:\+[\da-z-]+(?:\.[\da-z-]+)*)?)?)?$/i; const patch = /-([0-9A-Za-z-.]+)/; /** @@ -213,7 +214,9 @@ export const throttle = ( func.apply(null, args); lastRan = Date.now(); } else { - clearTimeout(timer); + if (timer) { + clearTimeout(timer); + } timer = setTimeout(() => { if (Date.now() - lastRan >= wait) { func.apply(null, args);