• Flatten a nested object into a single level object using 'SCREAMING_SNAKE_CASE'.

    Type Parameters

    • ObjT

    • OptionsT extends FlattenToScreamingSnakeCaseOptions | ExactObject<FlattenToScreamingSnakeCaseOptions, OptionsT> = {
          nestedDelimiter: "__";
      }

    Parameters

    • obj: ObjT

      input object.

    • Optional options: OptionsT

      output options.

    Returns ScreamingSnakeCaseProperties<FlattenObject<ObjT, OptionsT["nestedDelimiter"]>>

    Example

    const obj = {
    ccu: {
    django: {
    allowedHosts: '*',
    csrfCookieSecure: false,
    },
    },
    sentry: {
    traceExcludeUrls: ['one', 'two', 'three'],
    },
    }
    const result = convertToScreamingSnakeCase(obj, { nestedDelimiter: '__' })
    console.log(result)
    // {
    // CCU__DJANGO__ALLOWED_HOSTS: '*',
    // CCU__DJANGO__CSRF_COOKIE_SECURE: false,
    // SENTRY__TRACE_EXCLUDE_URLS: 'one,two,three',
    // }

Generated using TypeDoc