function trimSearchText(needle) {
  if (needle.charAt(0) === '/') {
    return needle.substr(1);
  }
  if (needle.charAt(needle.length - 1) === '/') {
    return needle.substr(0, needle.length - 1);
  }
  return needle;
}
'/foo/' => 'foo'
'/bar' => 'bar'
'baz' => 'baz'