lib/data-store/resource.js
function normalizeCollection (collection) {
  // Normalize the root path as an empty string
  collection = _(collection).toString();
  if (_.isEmpty(collection) || collection === "/" || collection === "//") {
    return "";
  }

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

  // Remove a trailing slash
  if (_.endsWith(collection, "/")) {
    collection = collection.substring(0, collection.length - 1);
  }

  return collection;
}
function normalizeCollection (collection) {
  // Normalize the root path as an empty string
  collection = _(collection).toString();
  if (_.isEmpty(collection) || collection === "/" || collection === "//") {
    return "";
  }

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

  // Remove a trailing slash
  if (_.endsWith(collection, "/")) {
    collection = collection.substring(0, collection.length - 1);
  }

  return collection;
}
function normalizeCollection ( collection ) { // Normalize the root path as an empty string collection = _ ( collection ) . toString ( ) ; if ( _ . isEmpty ( collection ) || collection === "/" || collection === "//" ) { return "" ; } // Add a leading slash if ( ! _ . startsWith ( collection , "/" ) ) { collection = "/" + collection ; } // Remove a trailing slash if ( _ . endsWith ( collection , "/" ) ) { collection = collection . substring ( 0 , collection . length - 1 ) ; } return collection ; }
Normalizes collection paths.

Examples:
/               => (empty string)
/users          => /users
/users/jdoe/    => /users/jdoe

@param   {string}    collection
@returns {string}
Normalizes collection paths .