Skip to content

Infisical is the open-source platform for securing secrets, certificates, access, and AI Agents.

444 B
Raw Blame
import picomatch from "picomatch";

export const doesFieldValueMatchJwtPolicy = (fieldValue: string | boolean | number, policyValue: string) => {
  if (typeof fieldValue === "boolean") {
    return fieldValue === (policyValue === "true");
  }

  if (typeof fieldValue === "number") {
    return fieldValue === parseInt(policyValue, 10);
  }

  return policyValue === fieldValue || picomatch.isMatch(fieldValue, policyValue, { bash: true });
};