Permalink
Browse files

listing resource types

  • Loading branch information...
1 parent 4200f1e commit cfe55b4e829035e45f8b538b329db4b865a2f81b @akamike akamike committed Jun 13, 2011
Showing with 27 additions and 17 deletions.
  1. +27 −17 lib/resource.js
View
@@ -31,21 +31,31 @@ function normalise(obj, key) {
return norm;
}
-module.exports = {
- Person: function(BC) {
- this.BC = BC;
- var self = this;
-
- this.create = function(data, raw) {
- if (!data) return false;
- var raw = raw || false;
-
- if (raw)
- data = normalise(data);
-
- return data;
- };
+var resources = {
+ "Category": function() {},
+ "Comment": function() {},
+ "Company": function() {},
+ "File": function() {},
+ "Message": function() {},
+ "Milestone": function() {},
+ "Person": function() {},
+ "Project": function() {},
+ "TodoItem": function() {},
+ "TodoList": function() {},
+ "Time": function() {}
+};
+
+for (var r in resources) {
+ var res = resources[r];
+ res.prototype.create = function(data, raw) {
+ if (!data) return false;
+ var raw = raw || false;
+
+ if (raw)
+ data = normalise(data);
+
+ return data;
+ };
+}
- return this;
- },
-};
+module.exports = resources;

0 comments on commit cfe55b4

Please sign in to comment.