Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
const validateTopLevelOptions = (options: Options) => {
const validOptions = Object.keys(TopLevelOptions);
for (const option in options) {
if (!TopLevelOptions[option]) {
throw new Error(
`Invalid Option: ${option} is not a valid top-level option.
Maybe you meant to use '${findSuggestion(validOptions, option)}'?`,
);
}
}
};
const validateTargetNames = (targets: Targets): void => {
const validTargets = Object.keys(TargetNames);
for (const target in targets) {
if (!TargetNames[target]) {
throw new Error(
`Invalid Option: '${target}' is not a valid target
Maybe you meant to use '${findSuggestion(validTargets, target)}'?`,
);
}
}
};