Initial
This commit is contained in:
21
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperty.js
generated
vendored
Normal file
21
resources/app/node_modules/@smithy/util-endpoints/dist-es/utils/getEndpointProperty.js
generated
vendored
Normal file
@@ -0,0 +1,21 @@
|
||||
import { EndpointError } from "../types";
|
||||
import { evaluateTemplate } from "./evaluateTemplate";
|
||||
import { getEndpointProperties } from "./getEndpointProperties";
|
||||
export const getEndpointProperty = (property, options) => {
|
||||
if (Array.isArray(property)) {
|
||||
return property.map((propertyEntry) => getEndpointProperty(propertyEntry, options));
|
||||
}
|
||||
switch (typeof property) {
|
||||
case "string":
|
||||
return evaluateTemplate(property, options);
|
||||
case "object":
|
||||
if (property === null) {
|
||||
throw new EndpointError(`Unexpected endpoint property: ${property}`);
|
||||
}
|
||||
return getEndpointProperties(property, options);
|
||||
case "boolean":
|
||||
return property;
|
||||
default:
|
||||
throw new EndpointError(`Unexpected endpoint property type: ${typeof property}`);
|
||||
}
|
||||
};
|
||||
Reference in New Issue
Block a user