Skip to content

Commit

Permalink
Revert "Apply plugins to schemas only once"
Browse files Browse the repository at this point in the history
  • Loading branch information
vkarpov15 committed May 6, 2016
1 parent 8e013c3 commit 7495208
Show file tree
Hide file tree
Showing 2 changed files with 0 additions and 19 deletions.
3 changes: 0 additions & 3 deletions lib/schema.js
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,6 @@ function Schema(obj, options) {
this._requiredpaths = undefined;
this.discriminatorMapping = undefined;
this._indexedpaths = undefined;
this._appliedPlugins = [];

this.s = {
hooks: new Kareem(),
Expand Down Expand Up @@ -906,8 +905,6 @@ Schema.prototype.post = function(method, fn) {
*/

Schema.prototype.plugin = function(fn, opts) {
if (this._appliedPlugins.indexOf(fn) > -1) { return this; }
this._appliedPlugins.push(fn);
fn(this, opts);
return this;
};
Expand Down
16 changes: 0 additions & 16 deletions test/schema.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -861,22 +861,6 @@ describe('schema', function() {
assert.equal(true, called);
done();
});

it('does not apply more than once', function(done) {
var Tobi = new Schema,
called = 0;

var plugin = function(schema) {
assert.equal(schema, Tobi);
called += 1;
};

Tobi.plugin(plugin);
Tobi.plugin(plugin);

assert.equal(1, called);
done();
});
});

describe('options', function() {
Expand Down

0 comments on commit 7495208

Please sign in to comment.