{"size": 1180, "ext": "js", "max_stars_repo_path": "my-js.js", "max_stars_repo_name": "gilhooleyd/pokemon-sqlite-wasm", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "my-js.js", "max_issues_repo_name": "gilhooleyd/pokemon-sqlite-wasm", "max_issues_repo_issues_event_min_datetime": null, "max_issues_repo_issues_event_max_datetime": null, "max_forks_repo_path": "my-js.js", "max_forks_repo_name": "gilhooleyd/pokemon-sqlite-wasm", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": null, "max_forks_count": null, "avg_line_length": 26.2222222222, "max_line_length": 98, "alphanum_fraction": 0.5245762712}
async function my_code() {

const SQL =  await initSqlJs({
  // Required to load the wasm binary asynchronously. Of course, you can host it wherever you want
  // You can omit locateFile completely when running in node
  locateFile: file => `sql-wasm.wasm`
});

var db;

fetch('pokedex.sql')
  .then(response => response.text())
  .then(body => {
    // Create a database
    db = new SQL.Database();
      db.run(body);
      const res = db.exec("SELECT * FROM pokemon WHERE hp>=100");
      columns = res[0].columns.map(x => { return { title: x } });
      $(document).ready(function() {

        $('#example').DataTable( {
            data: res[0].values,
            columns: columns,
            paging:   false,
        } );

        $("#submit").on("click", function () {
          const command = $("#query").val();
          console.log(command);
          const res = db.exec(command);
          columns = res[0].columns.map(x => { return { title: x } });
          $('#example').DataTable({
            destroy: true,
            data: res[0].values,
            columns: columns,
            paging: false,
          });
        });

        } );
  });
};

my_code();
