Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
availableHelper(name: string, versionRange: ?string): boolean {
let minVersion;
try {
minVersion = helpers.minVersion(name);
} catch (err) {
if (err.code !== "BABEL_HELPER_UNKNOWN") throw err;
return false;
}
if (typeof versionRange !== "string") return true;
// semver.intersects() has some surprising behavior with comparing ranges
// with preprelease versions. We add '^' to ensure that we are always
// comparing ranges with ranges, which sidesteps this logic.
// For example:
//
// semver.intersects(`<7.0.1`, "7.0.0-beta.0") // false - surprising
// semver.intersects(`<7.0.1`, "^7.0.0-beta.0") // true - expected
//