code: function getLayout(collection, name) {
    if (!name) return;
    if (collection instanceof Map) {
      for (const [key, view] of collection) {
        if (name === key) {
          return view;
        }
        if (!view.path) continue;
        if (!view.hasPath) {
          return getView(collection, name);
        }
        if (view.hasPath(name)) {
          return view;
        }
      }
      return;
    }
  
    for (const key of Object.keys(collection)) {
      const view = collection[key];
      if (name === key) {
        return view;
      }
      if (!view.path) continue;
      if (!view.hasPath) {
        return getView(collection, name);
      }
      if (view.hasPath(name)) {
        return view;
      }
    }
  }
docs: Gets the layout to use from the given collection