summaryrefslogtreecommitdiffstats
path: root/web/type.js
diff options
context:
space:
mode:
authorKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-02-06 13:12:50 +0200
committerKaarle Ritvanen <kaarle.ritvanen@datakunkku.fi>2014-02-12 12:38:31 +0200
commit8857a1753ba94c490211b06531995b6ad88506a6 (patch)
tree1c33a4122f6d7a2652f5e3d35bd0a3a6f32a2d9e /web/type.js
parent8991a77656de2e904087832df646e5dfd20b05a4 (diff)
downloadaconf-8857a1753ba94c490211b06531995b6ad88506a6.tar.bz2
aconf-8857a1753ba94c490211b06531995b6ad88506a6.tar.xz
web client: type module
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);
+ }
+ };
+});