UNPKG

@cloud-copilot/iam-simulate

Version:
27 lines 874 B
"use strict"; 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