{"size": 529, "ext": "js", "max_stars_repo_path": "src/visitors/tables/get-attribute-definitions.js", "max_stars_repo_name": "hicksy/package", "max_stars_repo_stars_event_min_datetime": "2019-05-28T21:53:50.000Z", "max_stars_repo_stars_event_max_datetime": "2020-05-08T06:52:13.000Z", "max_issues_repo_path": "src/visitors/tables/get-attribute-definitions.js", "max_issues_repo_name": "hicksy/package", "max_issues_repo_issues_event_min_datetime": "2019-07-21T23:15:36.000Z", "max_issues_repo_issues_event_max_datetime": "2022-02-16T17:07:06.000Z", "max_forks_repo_path": "src/visitors/tables/get-attribute-definitions.js", "max_forks_repo_name": "hicksy/package", "max_forks_repo_forks_event_min_datetime": "2019-07-10T19:58:02.000Z", "max_forks_repo_forks_event_max_datetime": "2022-01-23T13:30:53.000Z"}
{"max_stars_count": 4, "max_issues_count": 76, "max_forks_count": 9, "avg_line_length": 18.8928571429, "max_line_length": 70, "alphanum_fraction": 0.6465028355}
module.exports = function getAttributeDefinitions (table) {
  let defs = []
  let { partitionKey, partitionKeyType, sortKey, sortKeyType } = table

  // Always handle partition key
  defs.push({
    AttributeName: partitionKey,
    AttributeType: convert(partitionKeyType)
  })

  // Handle sort key if necessary
  if (sortKey) {
    defs.push({
      AttributeName: sortKey,
      AttributeType: convert(sortKeyType)
    })
  }

  return defs
}

function convert (v) {
  return ({
    'String': 'S',
    'Number': 'N'
  })[v]
}
