mirror of
https://github.com/awatertrevi/infisical.git
synced 2026-10-16 08:14:06 +00:00
14 lines
428 B
TypeScript
14 lines
428 B
TypeScript
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);
|
|
};
|