Skip to content

Commit

Permalink
Remove overzealous use of apply
Browse files Browse the repository at this point in the history
  • Loading branch information
Ben Ng committed Oct 28, 2013
1 parent 3e39e7b commit 94dae08
Showing 1 changed file with 7 additions and 7 deletions.
14 changes: 7 additions & 7 deletions lib/index.js
Expand Up @@ -656,7 +656,7 @@ utils.mixin(model, new (function () {
}

if (typeof data.beforeSave === 'function') {
data.beforeSave.apply(data);
data.beforeSave();
}
data.emit('beforeSave');
emitFunc();
Expand All @@ -667,7 +667,7 @@ utils.mixin(model, new (function () {
model[name].emit('save', res);
if (!isCollection) {
if (typeof data.afterSave === 'function') {
data.afterSave.apply(data);
data.afterSave();
}

data.emit('save');
Expand Down Expand Up @@ -720,7 +720,7 @@ utils.mixin(model, new (function () {
// Data may by just a bag or params, or an actual instance
if (typeof data.emit == 'function') {
if (typeof data.afterUpdate === 'function') {
data.afterUpdate.apply(data);
data.afterUpdate();
}
data.emit('update');
}
Expand Down Expand Up @@ -844,7 +844,7 @@ utils.mixin(model, new (function () {

// After-create hook
if (typeof item.afterCreate === 'function') {
item.afterCreate.apply(item);
item.afterCreate();
}
model[name].emit('create', item);
return item;
Expand All @@ -867,7 +867,7 @@ utils.mixin(model, new (function () {

// After-update hook
if (typeof item.afterUpdateProperties === 'function') {
item.afterUpdateProperties.apply(item);
item.afterUpdateProperties();
}

model[name].emit('updateProperties', item);
Expand All @@ -890,7 +890,7 @@ utils.mixin(model, new (function () {
, val;

if (typeof item.beforeValidate === 'function') {
item.beforeValidate.apply(item);
item.beforeValidate();
}
item.emit('beforeValidate')
model[name].emit('beforeValidate', item, passedParams);
Expand Down Expand Up @@ -959,7 +959,7 @@ utils.mixin(model, new (function () {

// After-update hook
if (typeof item.afterValidate === 'function') {
item.afterValidate.apply(item);
item.afterValidate();
}

item.emit('validate')
Expand Down

0 comments on commit 94dae08

Please sign in to comment.