mazey
    Preparing search index...

    Function convertCamelToSnake

    • Convert camel-case text to underscore-separated lowercase text.

      Insert an underscore before every uppercase ASCII letter, lowercase the result, and remove one leading underscore. Acronyms are split per letter: XMLParser becomes x_m_l_parser. Existing underscores are otherwise kept.

      Usage:

      import { convertCamelToSnake } from "mazey";

      const ret1 = convertCamelToSnake("ABC");
      const ret2 = convertCamelToSnake("aBC");
      console.log(ret1);
      console.log(ret2);

      Output:

      a_b_c
      a_b_c
      

      Parameters

      • camelCase: string

        "aBC" or "ABC"

      Returns string

      "a_b_c"