aboutsummaryrefslogtreecommitdiff
path: root/src/modules/internet
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/internet')
-rw-r--r--src/modules/internet/index.ts12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/modules/internet/index.ts b/src/modules/internet/index.ts
index a6b54838..842ab153 100644
--- a/src/modules/internet/index.ts
+++ b/src/modules/internet/index.ts
@@ -1,4 +1,5 @@
import type { Faker } from '../..';
+import { bindThisToMemberFunctions } from '../../internal/bind-this-to-member-functions';
import { deprecated } from '../../internal/deprecated';
import { charMapping } from './char-mappings';
import * as random_ua from './user-agent';
@@ -39,16 +40,7 @@ export type HTTPProtocolType = 'http' | 'https';
*/
export class InternetModule {
constructor(private readonly faker: Faker) {
- // Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(
- InternetModule.prototype
- ) as Array<keyof InternetModule | 'constructor'>) {
- if (name === 'constructor' || typeof this[name] !== 'function') {
- continue;
- }
-
- this[name] = this[name].bind(this);
- }
+ bindThisToMemberFunctions(this);
}
/**