Press n or j to go to the next uncovered block, b, p or k for the previous block.
| 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 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 | 1x 1x 22x 22x 22x 22x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 9x 9x 9x 9x 7x 7x 7x 7x 7x 9x 9x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x 1x | export default class Unsplash {
constructor(pure) {
this.pure = pure;
this.width = 640;
this.height = 480;
}
image(options = {}) {
const { width, height, keyword } = options;
return this.imageUrl({ width, height, keyword });
}
avatar() {
return this.pure.internet.avatar();
}
imageUrl(options = {}) {
const { width = this.width, height = this.height, keyword } = options;
let url = 'https://source.unsplash.com';
url += `/${width}x${height}`;
if (typeof keyword !== 'undefined') {
const keywordFormat = /^([A-Za-z0-9].+,[A-Za-z0-9]+)$|^([A-Za-z0-9]+)$/;
if (keywordFormat.test(keyword)) {
url += `?${keyword}`;
}
}
return url;
}
food(options = {}) {
const { width, height } = options;
return this.imageUrl({ width, height, keyword: 'food' });
}
people(options = {}) {
const { width, height } = options;
return this.imageUrl({ width, height, keyword: 'people' });
}
nature(options = {}) {
const { width, height } = options;
return this.imageUrl({ width, height, keyword: 'nature' });
}
technology(options = {}) {
const { width, height } = options;
return this.imageUrl({ width, height, keyword: 'technology' });
}
objects(options = {}) {
const { width, height } = options;
return this.imageUrl({ width, height, keyword: 'objects' });
}
buildings(options = {}) {
const { width, height } = options;
return this.imageUrl({ width, height, keyword: 'buildings' });
}
}
|