lib/data-store/resource.js
function normalizeName (name) {
  // Normalize directories as a single slash
  name = _(name).toString();
  if (_.isEmpty(name) || name === "/" || name === "//") {
    return "/";
  }

  // Add a leading slash
  if (!_.startsWith(name, "/")) {
    name = "/" + name;
  }

  // Don't allow slashes in the middle
  if (_.includes(name.substring(1, name.length - 1), "/")) {
    throw ono("Resource names cannot contain slashes");
  }

  return name;
}
function normalizeName (name) {
  // Normalize directories as a single slash
  name = _(name).toString();
  if (_.isEmpty(name) || name === "/" || name === "//") {
    return "/";
  }

  // Add a leading slash
  if (!_.startsWith(name, "/")) {
    name = "/" + name;
  }

  // Don't allow slashes in the middle
  if (_.includes(name.substring(1, name.length - 1), "/")) {
    throw ono("Resource names cannot contain slashes");
  }

  return name;
}
function normalizeName ( name ) { // Normalize directories as a single slash name = _ ( name ) . toString ( ) ; if ( _ . isEmpty ( name ) || name === "/" || name === "//" ) { return "/" ; } // Add a leading slash if ( ! _ . startsWith ( name , "/" ) ) { name = "/" + name ; } // Don't allow slashes in the middle if ( _ . includes ( name . substring ( 1 , name . length - 1 ) , "/" ) ) { throw ono ( "Resource names cannot contain slashes" ) ; } return name ; }
Normalizes resource names.

Examples:
/               => /
/users          => /users
users/          => /users/
/users/jdoe     => ERROR! Slashes aren't allowed in the middle

@param   {string}    name
@returns {string}
Normalizes resource names .