forked from foocoding/JavaScript3
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathRepository.js
More file actions
33 lines (28 loc) · 731 Bytes
/
Repository.js
File metadata and controls
33 lines (28 loc) · 731 Bytes
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
'use strict';
/* global Util */
// eslint-disable-next-line no-unused-vars
class Repository {
constructor(repository) {
this.repository = repository;
}
/**
* Render the repository info to the DOM.
* @param {HTMLElement} container The container element in which to render the repository.
*/
render(container) {
// TODO: replace the next line with your code.
Util.createAndAppend('pre', container, JSON.stringify(this.repository, null, 2));
}
/**
* Returns an array of contributors as a promise
*/
fetchContributors() {
return Util.fetchJSON(this.repository.contributors_url);
}
/**
* Returns the name of the repository
*/
name() {
return this.repository.name;
}
}