function featureString(entry) {
  return typeof entry === "string" ? entry : entry.id;
}
function featureScope(featureId) {
  const dotIndex = featureId.indexOf(".");
  return dotIndex === -1 ? featureId : featureId.slice(0, dotIndex);
}
function extractFeatureStrings(entries) {
  return entries.map(featureString);
}
function matchFeature(required, granted) {
  if (granted === "*") return true;
  if (granted.endsWith(".*")) {
    const prefix = granted.slice(0, -2);
    return required === prefix || required.startsWith(prefix + ".");
  }
  return granted === required;
}
function hasAllFeatures(required, granted) {
  if (!required.length) return true;
  if (!granted.length) return false;
  return required.every((req) => granted.some((g) => matchFeature(req, g)));
}
export {
  extractFeatureStrings,
  featureScope,
  featureString,
  hasAllFeatures,
  matchFeature
};
//# sourceMappingURL=featureMatch.js.map
