UNPKG

awscdk-construct-scte-scheduler

Version:

AWS CDK Construct for scheduling SCTE-35 events using the MediaLive schedule API

15 lines (14 loc) 669 B
import { getSanitizedTypeScriptVersion } from "./getSanitizedTypeScriptVersion"; const ALLOWED_PREFIXES = ["^", "~", ">=", "<=", ">", "<"]; const ALLOWED_DIST_TAGS = ["latest", "beta", "dev", "rc", "insiders", "next"]; export const getSanitizedDevTypeScriptVersion = (version = "") => { if (ALLOWED_DIST_TAGS.includes(version)) { return version; } const prefix = ALLOWED_PREFIXES.find((p) => version.startsWith(p)) ?? ""; const sanitizedTypeScriptVersion = getSanitizedTypeScriptVersion(version.slice(prefix.length)); if (!sanitizedTypeScriptVersion) { return undefined; } return `${prefix}${sanitizedTypeScriptVersion}`; };