Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
function validateSelector(selector: string): string {
if (selector.indexOf(',') !== -1) {
throw new Error(`Selector cannot contain commas: ${selector}`);
}
if (!Selector.isValid(selector)) {
throw new Error(`Invalid selector: ${selector}`);
}
return selector;
}
function validateSelector(options: CommandRegistry.IKeyBindingOptions): string {
if (options.selector.indexOf(',') !== -1) {
throw new Error(`Selector cannot contain commas: ${options.selector}`);
}
if (!Selector.isValid(options.selector)) {
throw new Error(`Invalid selector: ${options.selector}`);
}
return options.selector;
}