summaryrefslogtreecommitdiffstats
path: root/web/type.js
diff options
context:
space:
mode:
Diffstat (limited to 'web/type.js')
-rw-r--r--web/type.js22
1 files changed, 22 insertions, 0 deletions
diff --git a/web/type.js b/web/type.js
new file mode 100644
index 0000000..c597c0a
--- /dev/null
+++ b/web/type.js
@@ -0,0 +1,22 @@
+/*
+ * Copyright (c) 2012-2014 Kaarle Ritvanen
+ * See LICENSE file for license details
+ */
+
+define(["underscore"], function(_) {
+ function isList(meta) {
+ return _.contains(["list", "set"], meta.type);
+ }
+
+ function isCollection(meta) {
+ return meta.type == "collection" || isList(meta);
+ }
+
+ return {
+ isList: isList,
+ isCollection: isCollection,
+ isTreeNode: function(meta) {
+ return meta.type == "model" || isCollection(meta);
+ }
+ };
+});