{"size": 441, "ext": "js", "max_stars_repo_path": "packages/gatsby-recipes/src/renderer/babel-plugin-copy-key-prop.js", "max_stars_repo_name": "pipaliyajaydip/gatsby", "max_stars_repo_stars_event_min_datetime": "2015-06-28T12:31:47.000Z", "max_stars_repo_stars_event_max_datetime": "2022-03-31T21:58:53.000Z", "max_issues_repo_path": "packages/gatsby-recipes/src/renderer/babel-plugin-copy-key-prop.js", "max_issues_repo_name": "pipaliyajaydip/gatsby", "max_issues_repo_issues_event_min_datetime": "2015-06-22T22:26:14.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-31T22:36:53.000Z", "max_forks_repo_path": "packages/gatsby-recipes/src/renderer/babel-plugin-copy-key-prop.js", "max_forks_repo_name": "pipaliyajaydip/gatsby", "max_forks_repo_forks_event_min_datetime": "2015-07-28T17:27:07.000Z", "max_forks_repo_forks_event_max_datetime": "2022-03-31T22:31:15.000Z"}
{"max_stars_count": 57637, "max_issues_count": 26263, "max_forks_count": 15167, "avg_line_length": 24.5, "max_line_length": 54, "alphanum_fraction": 0.5759637188}
export default function babelPluginCopyKeyProp(api) {
  const { types: t } = api

  return {
    visitor: {
      JSXIdentifier(path) {
        if (path.node.name === `key`) {
          const clonePath = t.cloneNode(path.node)
          const cloneParent = t.cloneNode(path.parent)
          clonePath.name = `_key`
          cloneParent.name = clonePath
          path.parentPath.container.push(cloneParent)
        }
      },
    },
  }
}
