aws-sdk-js-codemod
Version:
Collection of codemod scripts that help update AWS SDK for JavaScript APIs
27 lines (26 loc) • 994 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.getWaiterConfigValue = void 0;
const getWaiterConfigValue = (waiterConfiguration, key) => {
for (const property of waiterConfiguration.properties) {
if (property.type !== "Property" && property.type !== "ObjectProperty") {
continue;
}
if (property.key.type !== "Identifier") {
continue;
}
if (property.key.name === key) {
const propertyValue = property.value;
if (propertyValue.type === "Literal" || propertyValue.type === "StringLiteral") {
if (typeof propertyValue.value === "number") {
return propertyValue.value.toString();
}
if (typeof propertyValue.value === "string") {
return propertyValue.value;
}
}
return;
}
}
};
exports.getWaiterConfigValue = getWaiterConfigValue;