summaryrefslogtreecommitdiffstats
path: root/web/type.js
blob: 0ae084e1eb8e838e9f7e7faaee9d7c1f159254f9 (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-2015 Kaarle Ritvanen
 * See LICENSE file for license details
 */

angular.module("aconf").factory("aconfType", 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);
	}
    };
});