aboutsummaryrefslogtreecommitdiff
path: root/src/modules/number
diff options
context:
space:
mode:
Diffstat (limited to 'src/modules/number')
-rw-r--r--src/modules/number/index.ts12
1 files changed, 2 insertions, 10 deletions
diff --git a/src/modules/number/index.ts b/src/modules/number/index.ts
index fce3829a..9472fb82 100644
--- a/src/modules/number/index.ts
+++ b/src/modules/number/index.ts
@@ -1,5 +1,6 @@
import type { Faker } from '../..';
import { FakerError } from '../../errors/faker-error';
+import { bindThisToMemberFunctions } from '../../internal/bind-this-to-member-functions';
import type { Mersenne } from '../../internal/mersenne/mersenne';
/**
@@ -18,16 +19,7 @@ import type { Mersenne } from '../../internal/mersenne/mersenne';
*/
export class NumberModule {
constructor(private readonly faker: Faker) {
- // Bind `this` so namespaced is working correctly
- for (const name of Object.getOwnPropertyNames(
- NumberModule.prototype
- ) as Array<keyof NumberModule | 'constructor'>) {
- if (name === 'constructor' || typeof this[name] !== 'function') {
- continue;
- }
-
- this[name] = this[name].bind(this);
- }
+ bindThisToMemberFunctions(this);
}
/**