Skip to content

Commit

Permalink
[api] [refactor] Remove bindAll method #376
Browse files Browse the repository at this point in the history
  * Was previously used for `this` scoping issue
  * Should no longer be needed
  * Should not cause any issues
  • Loading branch information
Marak committed Oct 28, 2018
1 parent f631665 commit 72dce11
Showing 1 changed file with 16 additions and 26 deletions.
42 changes: 16 additions & 26 deletions lib/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -38,69 +38,59 @@ function Faker (opts) {

self.definitions = {};

function bindAll(obj) {
Object.keys(obj).forEach(function(meth) {
if (typeof obj[meth] === 'function') {
obj[meth] = obj[meth].bind(obj);
}
});
return obj;
}

var Fake = require('./fake');
self.fake = new Fake(self).fake;

var Unique = require('./unique');
self.unique = bindAll(new Unique(self).unique);
self.unique = new Unique(self).unique;

var Random = require('./random');
self.random = bindAll(new Random(self));
self.random = new Random(self);

var Helpers = require('./helpers');
self.helpers = new Helpers(self);


var Name = require('./name');
self.name = bindAll(new Name(self));
self.name = new Name(self);

var Address = require('./address');
self.address = bindAll(new Address(self));
self.address = new Address(self);

var Company = require('./company');
self.company = bindAll(new Company(self));
self.company = new Company(self);

var Finance = require('./finance');
self.finance = bindAll(new Finance(self));
self.finance = new Finance(self);

var Image = require('./image');
self.image = bindAll(new Image(self));
self.image = new Image(self);

var Lorem = require('./lorem');
self.lorem = bindAll(new Lorem(self));
self.lorem = new Lorem(self);

var Hacker = require('./hacker');
self.hacker = bindAll(new Hacker(self));
self.hacker = new Hacker(self);

var Internet = require('./internet');
self.internet = bindAll(new Internet(self));
self.internet = new Internet(self);

var Database = require('./database');
self.database = bindAll(new Database(self));
self.database = new Database(self);

var Phone = require('./phone_number');
self.phone = bindAll(new Phone(self));
self.phone = new Phone(self);

var _Date = require('./date');
self.date = bindAll(new _Date(self));
self.date = new _Date(self);

var Commerce = require('./commerce');
self.commerce = bindAll(new Commerce(self));
self.commerce = new Commerce(self);

var System = require('./system');
self.system = bindAll(new System(self));
self.system = new System(self);

var Git = require('./git');
self.git = bindAll(new Git(self));
self.git = new Git(self);

var _definitions = {
"name": ["first_name", "last_name", "prefix", "suffix", "gender", "title", "male_prefix", "female_prefix", "male_first_name", "female_first_name", "male_middle_name", "female_middle_name", "male_last_name", "female_last_name"],
Expand Down

0 comments on commit 72dce11

Please sign in to comment.