Wondering what’s next for npm?Check out our public roadmap! »

    @leothesen/change-case

    1.3.0 • Public • Published

    change-case

    Recursive functions for changing the case of object fields. Best

    Install

    npm install @leothesen/change-case

    Usage

    const {  
      toCamelCase,
      toSnakeCase
    = require('@leothesen/change-case');
     
    const snake_case = {
      mixed_array_field: [
        'text',
        {
          plain_field: 'text',
          mixed_object_field: {
            numeric_field: 42,
            arrary_field: [
              42,
              'fourty two',
              { fourty_two: 42 }
            ]
          }
        }
      ]
    };
     
    const camelCase = toCamelCase(snake_case);
    /**
     * camelCase = {
     *  plainField: 'text',
     *  mixedObjectField: {
     *    numericField: 42,
     *    arrayField: [
     *      42,
     *      'fourty two',
     *      { fourtyTwo: 42}
     *    ]
     *  }
     * }
     */

    License

    MIT

    Install

    npm i @leothesen/change-case

    DownloadsWeekly Downloads

    116

    Version

    1.3.0

    License

    MIT

    Unpacked Size

    6.07 kB

    Total Files

    13

    Last publish

    Collaborators

    • avatar