static select()

in packages/libs/codegen/src/formatter/formatter.ts [103:133]


  static select(style: any, fallback: Styler, maxUppercasePreserve: number): Styler {
    if (style) {
      const styles = /^([a-zA-Z0-9_]*?\+?)([a-zA-Z]+)(\+?[a-zA-Z0-9_]*)$/g.exec(style.replace(/\s*/g, ""));
      if (styles) {
        const prefix = styles[1] ? styles[1].substring(0, styles[1].length - 1) : "";
        const postfix = styles[3] ? styles[3].substring(1) : "";

        switch (styles[2]) {
          case "camelcase":
          case "camel":
            return wrap(prefix, postfix, Style.camel, maxUppercasePreserve);
          case "pascalcase":
          case "pascal":
            return wrap(prefix, postfix, Style.pascal, maxUppercasePreserve);
          case "snakecase":
          case "snake":
            return wrap(prefix, postfix, Style.snake, maxUppercasePreserve);
          case "uppercase":
          case "upper":
            return wrap(prefix, postfix, Style.upper, maxUppercasePreserve);
          case "kebabcase":
          case "kebab":
            return wrap(prefix, postfix, Style.kebab, maxUppercasePreserve);
          case "spacecase":
          case "space":
            return wrap(prefix, postfix, Style.space, maxUppercasePreserve);
        }
      }
    }
    return wrap("", "", fallback, maxUppercasePreserve);
  }