UNPKG

lambda-live-debugger

Version:

Debug Lambda functions locally like it is running in the cloud

10 lines (9 loc) 554 B
const SEMVER_REGEX = /^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+[0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*)?$/; export const getSanitizedTypeScriptVersion = (version = "") => { const match = version.match(SEMVER_REGEX); if (!match) { return undefined; } const [major, minor, patch, prerelease] = [match[1], match[2], match[3], match[4]]; return prerelease ? `${major}.${minor}.${patch}-${prerelease}` : `${major}.${minor}.${patch}`; };