11import type { Faker } from '..' ;
22
3+ /**
4+ * Module to generate links to random images on `https://lorempixel.com/`.
5+ */
36export class Lorempixel {
47 constructor ( private readonly faker : Faker ) { }
58
69 /**
7- * image
10+ * Generates a new lorempixel image url for a random supported category.
811 *
9- * @param width
10- * @param height
11- * @param randomize
12+ * @param width The width of the image. Defaults to `640`.
13+ * @param height The height of the image. Defaults to `480`.
14+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
1215 */
1316 image ( width ?: number , height ?: number , randomize ?: boolean ) : string {
1417 const categories = [
@@ -34,19 +37,24 @@ export class Lorempixel {
3437 }
3538
3639 /**
37- * avatar
40+ * Returns a random avatar url.
41+ *
42+ * @example
43+ * faker.internet.avatar()
44+ * // 'https://cloudflare-ipfs.com/ipfs/Qmd3W5DuhgHirLHGVixi6V76LhCkZUz6pnFt5AJBiyvHye/avatar/315.jpg'
3845 */
46+ // TODO ST-DDT 2022-03-11: Deprecate this method as it is duplicate and has nothing to do with lorempixel.
3947 avatar ( ) : string {
4048 return this . faker . internet . avatar ( ) ;
4149 }
4250
4351 /**
44- * imageUrl
52+ * Generates a new lorempixel image url.
4553 *
46- * @param width
47- * @param height
48- * @param category
49- * @param randomize
54+ * @param width The width of the image. Defaults to `640`.
55+ * @param height The height of the image. Defaults to `480`.
56+ * @param category The category of the image to generate.
57+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
5058 */
5159 imageUrl (
5260 width ?: number ,
@@ -70,11 +78,11 @@ export class Lorempixel {
7078 }
7179
7280 /**
73- * abstract
81+ * Generates a new lorempixel image url using the " abstract" category.
7482 *
75- * @param width
76- * @param height
77- * @param randomize
83+ * @param width The width of the image. Defaults to `640`.
84+ * @param height The height of the image. Defaults to `480`.
85+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
7886 */
7987 abstract ( width ?: number , height ?: number , randomize ?: boolean ) : string {
8088 return this . faker . image . lorempixel . imageUrl (
@@ -86,11 +94,11 @@ export class Lorempixel {
8694 }
8795
8896 /**
89- * animals
97+ * Generates a new lorempixel image url using the " animals" category.
9098 *
91- * @param width
92- * @param height
93- * @param randomize
99+ * @param width The width of the image. Defaults to `640`.
100+ * @param height The height of the image. Defaults to `480`.
101+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
94102 */
95103 animals ( width ?: number , height ?: number , randomize ?: boolean) : string {
96104 return this . faker . image . lorempixel . imageUrl (
@@ -102,11 +110,11 @@ export class Lorempixel {
102110 }
103111
104112 /**
105- * business
113+ * Generates a new lorempixel image url using the " business" category.
106114 *
107- * @param width
108- * @param height
109- * @param randomize
115+ * @param width The width of the image. Defaults to `640`.
116+ * @param height The height of the image. Defaults to `480`.
117+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
110118 */
111119 business ( width ?: number , height ?: number , randomize ?: boolean) : string {
112120 return this . faker . image . lorempixel . imageUrl (
@@ -118,11 +126,11 @@ export class Lorempixel {
118126 }
119127
120128 /**
121- * cats
129+ * Generates a new lorempixel image url using the " cats" category.
122130 *
123- * @param width
124- * @param height
125- * @param randomize
131+ * @param width The width of the image. Defaults to `640`.
132+ * @param height The height of the image. Defaults to `480`.
133+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
126134 */
127135 cats ( width ?: number , height ?: number , randomize ?: boolean) : string {
128136 return this . faker . image . lorempixel . imageUrl (
@@ -134,11 +142,11 @@ export class Lorempixel {
134142 }
135143
136144 /**
137- * city
145+ * Generates a new lorempixel image url using the " city" category.
138146 *
139- * @param width
140- * @param height
141- * @param randomize
147+ * @param width The width of the image. Defaults to `640`.
148+ * @param height The height of the image. Defaults to `480`.
149+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
142150 */
143151 city ( width ?: number , height ?: number , randomize ?: boolean) : string {
144152 return this . faker . image . lorempixel . imageUrl (
@@ -150,11 +158,11 @@ export class Lorempixel {
150158 }
151159
152160 /**
153- * food
161+ * Generates a new lorempixel image url using the " food" category.
154162 *
155- * @param width
156- * @param height
157- * @param randomize
163+ * @param width The width of the image. Defaults to `640`.
164+ * @param height The height of the image. Defaults to `480`.
165+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
158166 */
159167 food ( width ?: number , height ?: number , randomize ?: boolean) : string {
160168 return this . faker . image . lorempixel . imageUrl (
@@ -166,11 +174,11 @@ export class Lorempixel {
166174 }
167175
168176 /**
169- * nightlife
177+ * Generates a new lorempixel image url using the " nightlife" category.
170178 *
171- * @param width
172- * @param height
173- * @param randomize
179+ * @param width The width of the image. Defaults to `640`.
180+ * @param height The height of the image. Defaults to `480`.
181+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
174182 */
175183 nightlife ( width ?: number , height ?: number , randomize ?: boolean) : string {
176184 return this . faker . image . lorempixel . imageUrl (
@@ -182,11 +190,11 @@ export class Lorempixel {
182190 }
183191
184192 /**
185- * fashion
193+ * Generates a new lorempixel image url using the " fashion" category.
186194 *
187- * @param width
188- * @param height
189- * @param randomize
195+ * @param width The width of the image. Defaults to `640`.
196+ * @param height The height of the image. Defaults to `480`.
197+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
190198 */
191199 fashion ( width ?: number , height ?: number , randomize ?: boolean) : string {
192200 return this . faker . image . lorempixel . imageUrl (
@@ -198,11 +206,11 @@ export class Lorempixel {
198206 }
199207
200208 /**
201- * people
209+ * Generates a new lorempixel image url using the " people" category.
202210 *
203- * @param width
204- * @param height
205- * @param randomize
211+ * @param width The width of the image. Defaults to `640`.
212+ * @param height The height of the image. Defaults to `480`.
213+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
206214 */
207215 people ( width ?: number , height ?: number , randomize ?: boolean) : string {
208216 return this . faker . image . lorempixel . imageUrl (
@@ -214,11 +222,11 @@ export class Lorempixel {
214222 }
215223
216224 /**
217- * nature
225+ * Generates a new lorempixel image url using the " nature" category.
218226 *
219- * @param width
220- * @param height
221- * @param randomize
227+ * @param width The width of the image. Defaults to `640`.
228+ * @param height The height of the image. Defaults to `480`.
229+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
222230 */
223231 nature ( width ?: number , height ?: number , randomize ?: boolean) : string {
224232 return this . faker . image . lorempixel . imageUrl (
@@ -230,11 +238,11 @@ export class Lorempixel {
230238 }
231239
232240 /**
233- * sports
241+ * Generates a new lorempixel image url using the " sports" category.
234242 *
235- * @param width
236- * @param height
237- * @param randomize
243+ * @param width The width of the image. Defaults to `640`.
244+ * @param height The height of the image. Defaults to `480`.
245+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
238246 */
239247 sports ( width ?: number , height ?: number , randomize ?: boolean) : string {
240248 return this . faker . image . lorempixel . imageUrl (
@@ -246,11 +254,11 @@ export class Lorempixel {
246254 }
247255
248256 /**
249- * technics
257+ * Generates a new lorempixel image url using the " technics" category.
250258 *
251- * @param width
252- * @param height
253- * @param randomize
259+ * @param width The width of the image. Defaults to `640`.
260+ * @param height The height of the image. Defaults to `480`.
261+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
254262 */
255263 technics ( width ?: number , height ?: number , randomize ?: boolean) : string {
256264 return this . faker . image . lorempixel . imageUrl (
@@ -262,11 +270,11 @@ export class Lorempixel {
262270 }
263271
264272 /**
265- * transport
273+ * Generates a new lorempixel image url using the " transport" category.
266274 *
267- * @param width
268- * @param height
269- * @param randomize
275+ * @param width The width of the image. Defaults to `640`.
276+ * @param height The height of the image. Defaults to `480`.
277+ * @param randomize Whether to append a seed to the url. Defaults to `false`.
270278 */
271279 transport ( width ?: number , height ?: number , randomize ?: boolean) : string {
272280 return this . faker . image . lorempixel . imageUrl (
0 commit comments