{"size": 836, "ext": "js", "max_stars_repo_path": "lib/encode.js", "max_stars_repo_name": "Pietrum/godot-packet", "max_stars_repo_stars_event_min_datetime": "2021-11-03T21:07:14.000Z", "max_stars_repo_stars_event_max_datetime": "2021-12-12T01:18:28.000Z", "max_issues_repo_path": "lib/encode.js", "max_issues_repo_name": "Pietrum/godot-packet", "max_issues_repo_issues_event_min_datetime": "2020-04-22T15:37:42.000Z", "max_issues_repo_issues_event_max_datetime": "2020-04-25T09:29:29.000Z", "max_forks_repo_path": "lib/encode.js", "max_forks_repo_name": "Pietrum/godot-packet", "max_forks_repo_forks_event_min_datetime": "2019-01-21T23:34:10.000Z", "max_forks_repo_forks_event_max_datetime": "2019-01-21T23:34:10.000Z"}
{"max_stars_count": 2, "max_issues_count": 1, "max_forks_count": 1, "avg_line_length": 22.0, "max_line_length": 71, "alphanum_fraction": 0.5227272727}
module.exports = (variant) => {
  let encoder = './encode/';

  if (variant === null) {
    encoder += 'undefined';
  } else if (typeof variant === 'object') {
    switch (variant.constructor.name) {
      case 'Vector2':
      case 'Rect2':
      case 'Vector3':
      case 'Transform2D':
      case 'Plane':
      case 'Quat':
      case 'AABB':
      case 'Basis':
      case 'Transform':
        encoder += 'math';
        break;
      case 'Color':
        encoder += 'color';
        break;
      case 'NodePath':
        encoder += 'node_path';
        break;
      case 'Array':
        encoder += 'array';
        break;
      default:
        encoder += 'json';
    }
  } else {
    encoder += typeof variant;
  }

  // eslint-disable-next-line global-require, import/no-dynamic-require
  return require(encoder)(variant);
};
