summaryrefslogtreecommitdiffstats
path: root/web/type.js
blob: c597c0a8841759a099df939a4adda42f7d8c71c5 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
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);
	}
    };
});