@aws/cloudfront-hosting-toolkit
Version:
CloudFront Hosting Toolkit offers the convenience of a managed frontend hosting service while retaining full control over the hosting and deployment infrastructure to make it your own.
19 lines (18 loc) • 440 B
JavaScript
const BYTE_LIMIT = 1024;
export function encodeFeatures(features) {
let buffer = "";
for (const key in features) {
const val = features[key];
if (buffer.length + val.length + 1 <= BYTE_LIMIT) {
if (buffer.length) {
buffer += "," + val;
}
else {
buffer += val;
}
continue;
}
break;
}
return buffer;
}