Skip to content

Commit 37a2ef2

Browse files
committed
fix: this binding
1 parent 9244e02 commit 37a2ef2

File tree

1 file changed

+11
-2
lines changed

1 file changed

+11
-2
lines changed

src/lorem.ts

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -140,7 +140,7 @@ export class Lorem {
140140
// TODO @Shinigami92 2022-01-11: Is this a function-name alias?
141141
// Or can we just remove the `loremText`?
142142
// TODO @Shinigami92 2022-01-11: `times` is not in use
143-
text = function loremText(times?: number) {
143+
text(times?: number): string {
144144
const loremMethods = [
145145
'lorem.word',
146146
'lorem.words',
@@ -152,7 +152,16 @@ export class Lorem {
152152
];
153153
const randomLoremMethod = this.faker.random.arrayElement(loremMethods);
154154
return this.faker.fake('{{' + randomLoremMethod + '}}');
155-
};
155+
}
156+
157+
/**
158+
* Alias for `text`.
159+
*
160+
* @param times
161+
*/
162+
loremText(times?: number): string {
163+
return this.text(times);
164+
}
156165

157166
/**
158167
* Returns lines of lorem separated by `'\n'`

0 commit comments

Comments
 (0)