utils.js 613 B

12345678910111213141516171819202122232425262728
  1. allowIsBoardAdmin = function(userId, board) {
  2. return board && board.hasAdmin(userId);
  3. };
  4. allowIsBoardMember = function(userId, board) {
  5. return board && board.hasMember(userId);
  6. };
  7. // todo XXX not really server-specific,
  8. // so move it to a common (client+server) lib?
  9. Utils = {
  10. /**
  11. * If text starts with a / will remove it.
  12. * @param text
  13. */
  14. stripLeadingSlash(text) {
  15. // we need an actual text string
  16. if (!text) {
  17. return text;
  18. }
  19. // if starting with slash
  20. if (text[0] === '/') {
  21. return text.slice(1);
  22. }
  23. // otherwise leave untouched
  24. return text;
  25. },
  26. };