vorteil/direktiv

View on GitHub
ui/src/pages/namespace/Explorer/Tree/utils.ts

Summary

Maintainability
A
0 mins
Test Coverage
const yamlExtensions = [
  ".yaml", // this first one is the default
  ".yml",
] as const;

export const addYamlFileExtension = (name: string) => {
  const newName = name.trim();
  if (yamlExtensions.some((extension) => newName.endsWith(extension))) {
    return newName;
  }
  return `${newName}${yamlExtensions[0]}`;
};