@cloud-copilot/iam-simulate
Version:
Simulate evaluation of AWS IAM policies
23 lines • 701 B
JavaScript
/**
* Check if a condition key is an array types
*
* @param key the condition key type to check
* @returns true if the key is an array type, otherwise false
*/
export function isConditionKeyArray(key) {
return key.startsWith('ArrayOf');
}
/**
* Get the BaseConditionKeyType from an ArrayConditionKeyType
*
* @param key the ArrayConditionKeyType to get the base type from
* @returns the base type of the array key
* @throws if the key is not an array type
*/
export function getBaseConditionKeyType(key) {
if (!isConditionKeyArray(key)) {
throw new Error(`Expected ArrayConditionType, got ${key}`);
}
return key.slice(7);
}
//# sourceMappingURL=contextKeyTypes.js.map