summaryrefslogtreecommitdiffstats
path: root/server/lib/utils.js
blob: a6a84f90d88a1d7ecf30bf28b6c4c888b9a9cdb3 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
allowIsBoardAdmin = function(userId, board) {
  return board && board.hasAdmin(userId);
};

allowIsBoardMember = function(userId, board) {
  return board && board.hasMember(userId);
};

// todo XXX not really server-specific,
// so move it to a common (client+server) lib?
Utils = {
  /**
   * If text starts with a / will remove it.
   * @param text
   */
  stripLeadingSlash(text) {
    // we need an actual text string
    if (!text) {
      return text;
    }
    // if starting with slash
    if (text[0] === '/') {
      return text.slice(1);
    }
    // otherwise leave untouched
    return text;
  },
};