{"size": 1182, "ext": "js", "max_stars_repo_path": "Front-end/JavaScript-UI-and-DOM/Homework/10. HTML Templates/tasks/task-1.js", "max_stars_repo_name": "jsdelivrbot/Telerik_Academy", "max_stars_repo_stars_event_min_datetime": null, "max_stars_repo_stars_event_max_datetime": null, "max_issues_repo_path": "Front-end/JavaScript-UI-and-DOM/Homework/10. HTML Templates/tasks/task-1.js", "max_issues_repo_name": "jsdelivrbot/Telerik_Academy", "max_issues_repo_issues_event_min_datetime": "2020-09-04T15:10:57.000Z", "max_issues_repo_issues_event_max_datetime": "2022-03-02T04:33:37.000Z", "max_forks_repo_path": "Front-end/JavaScript-UI-and-DOM/Homework/10. HTML Templates/tasks/task-1.js", "max_forks_repo_name": "jsdelivrbot/Telerik_Academy", "max_forks_repo_forks_event_min_datetime": null, "max_forks_repo_forks_event_max_datetime": null}
{"max_stars_count": null, "max_issues_count": 6, "max_forks_count": null, "avg_line_length": 15.5526315789, "max_line_length": 56, "alphanum_fraction": 0.5211505922}
/* globals $ */

function solve() {
    return function (selector) {
        var template = `
<table class="items-table">
<thead>
<tr>
<th>#</th>
{{#each headers}}
<th>{{this}}</th>
{{/each}}
</tr>
</thead>
<tbody>
{{#each items}}
<tr>
<td>{{@index}}</td>
<td>{{this.col1}}</td>
<td>{{this.col2}}</td>
<td>{{this.col3}}</td>
</tr>
{{/each}}
</tbody>
</table>`;

        $(selector).html(template);
    };
};
module.exports = solve;


/*
var HbTemplate = `
<table class="items-table">
<thead>
<tr>
<th>#</th>
{{#each headers}}
<th>{{this}}</th>
{{/each}}
</tr>
</thead>
<tbody>
{{#each items}}
<tr>
<td>{{@index}}</td>
<td>{{this.col1}}</td>
<td>{{this.col2}}</td>
<td>{{this.col3}}</td>
</tr>
{{/each}}
</tbody>
</table>`;

var data = {
    headers: ['Vendor', 'Model', 'OS'],
    items: [{
        col1: 'Nokia',
        col2: 'Lumia 920',
        col3: 'Windows Phone'
    }, {
        col1: 'LG',
        col2: 'Nexus 5',
        col3: 'Android'
    }, {
        col1: 'Apple',
        col2: 'iPhone 6',
        col3: 'iOS'
    }]
};
var container = document.getElementById('hb-container');
var template = Handlebars.compile(HbTemplate);
container.innerHTML = template(data);
*/
