summaryrefslogtreecommitdiff
path: root/app/node_modules/okresource/index.js
diff options
context:
space:
mode:
authorSean Fridman <fridman@mail.sfsu.edu>2015-04-03 13:12:34 -0400
committerSean Fridman <fridman@mail.sfsu.edu>2015-04-06 15:27:52 -0400
commit35bdb78a6701b919157b0dafa75ff39904197d49 (patch)
tree9d16a52117b078e152e2a39abec84e2b294fee03 /app/node_modules/okresource/index.js
parent8ea01b6737259f7380a1295d538456ebc4d1c30f (diff)
Expose schema as part of resource API
Diffstat (limited to 'app/node_modules/okresource/index.js')
-rw-r--r--app/node_modules/okresource/index.js8
1 files changed, 6 insertions, 2 deletions
diff --git a/app/node_modules/okresource/index.js b/app/node_modules/okresource/index.js
index 9f0c9d4..055a24a 100644
--- a/app/node_modules/okresource/index.js
+++ b/app/node_modules/okresource/index.js
@@ -17,7 +17,11 @@ function OKResource(options) {
throw new Error('No DB provided to OKResource');
var type = options.type;
this._db = options.db;
- this._schema = options.schema;
+ // Define properties which are part of the API
+ Object.defineProperty(this, 'schema', {
+ value: schema,
+ writable: false
+ });
Object.defineProperty(this, 'type', {
value: type,
writable: false
@@ -28,7 +32,7 @@ function OKResource(options) {
* Throws an error if data does not conform to schema
*/
OKResource.prototype.assertValid = function(data) {
- this._schema.assertValid(data);
+ this.schema.assertValid(data);
};
OKResource.prototype.all = function() {