@cloud-copilot/iam-simulate
Version:
Simulate evaluation of AWS IAM policies
27 lines • 874 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.isConditionKeyArray = isConditionKeyArray;
exports.getBaseConditionKeyType = getBaseConditionKeyType;
/**
* 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
*/
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
*/
function getBaseConditionKeyType(key) {
if (!isConditionKeyArray(key)) {
throw new Error(`Expected ArrayConditionType, got ${key}`);
}
return key.slice(7);
}
//# sourceMappingURL=contextKeyTypes.js.map