How to use the codemaker.toCamelCase function in codemaker

To help you get started, we’ve selected a few codemaker examples, based on popular ways it is used in public projects.

Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.

github aws / aws-cdk / packages / cdk-dasm / lib / dasm.ts View on Github external
if (typeof(x) === 'function') {
    throw new Error(`function?`);
  }

  if (Array.isArray(x)) {
    return x.map(i => capitalizeKeys(i));
  }

  if (typeof(x) === 'object') {
    const ret: { [key: string]: any } = {};
    for (const [ key, value ] of Object.entries(x)) {
      let newKey;
      if (key === 'Ref' || key.startsWith('Fn::')) {
        newKey = key;
      } else {
        newKey = toCamelCase(key);
      }

      ret[newKey] = capitalizeKeys(value);
    }
    return ret;
  }

  // primitive
  return x;
}

codemaker

A tiny utility for generating source code

Apache-2.0
Latest version published 7 days ago

Package Health Score

98 / 100
Full package analysis

Popular codemaker functions