Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Don't add Model getters or setters to the stack unless they are funct…

…ions.
  • Loading branch information...
commit 975cf8513303d4aab5e57c60c4287470c43eb1e0 1 parent 9faaa3f
@ljharb authored aheckmann committed
Showing with 2 additions and 1 deletion.
  1. +2 −1  lib/schematype.js
View
3  lib/schematype.js
@@ -1,4 +1,3 @@
-
/**
* Module dependencies.
*/
@@ -116,6 +115,7 @@ SchemaType.prototype.sparse = function (bool) {
*/
SchemaType.prototype.set = function (fn) {
+ if (typeof (fn) !== 'function') { throw new Error('A setter must be a function.'); }
this.setters.push(fn);
return this;
};
@@ -128,6 +128,7 @@ SchemaType.prototype.set = function (fn) {
*/
SchemaType.prototype.get = function (fn) {
+ if (typeof (fn) !== 'function') { throw new Error('A getter must be a function.'); }
this.getters.push(fn);
return this;
};
Please sign in to comment.
Something went wrong with that request. Please try again.